Creating a New Class Data Member

This section describes how to create a new data member for a class in the Data Warehouse. The class must exist prior to creating the data member.

A class member is created by inserting a new instance in the Member Definition (MemDef) table, populating the attributes, and saving the changes. For information on the Member Definition table, see Member Definition Meta-data.

The running example (which originates in Creating a New Class) continues by creating the OrderForm_Id and ordergroup_id members of the OrderFormHeader class. For details on the existing class, see the OrderFormHeader class. Additional class members are created in the same way.

The following table lists the attributes and values in the Member Definition table for the OrderForm_Id member. Unspecified optional attributes are not shown. In the R/O column, R = required, O = optional.

Attribute Name Attribute Value Type R/O Purpose
MemberDefName "OrderForm_Id" String R Uniquely identifies the data member for the class.
ClassDefName "OrderFormHeader" String R Stores the name of the containing class.
TypeName "UUID" String R Identifies the data type of the data member.
Description "Identifier for an order form." String O Describes the logical concept underlying the data member.
IsActive 1 Integer O This is an active data member (that is, instances may be added).
IsPersistent 1 Integer O Persist instances of this data member in the underlying data store.
IsPrimaryKey 0 Integer O This attribute is set to True (1) when the GenerateKeyDef attribute is True in the Class definition to have the Provider automatically generate the class key. This is not allowed for multi-membered keys.
IsRequired 1 Integer O This data member is required.

The following table lists the attributes and values in the Member Definition table for the ordergroup_id member. Unspecified optional attributes are not shown.

Attribute Name Attribute Value Type R/O Purpose
MemberDefName "ordergroup_d" String R Uniquely identifies the data member for the class.
ClassDefName "OrderFormHeader" String R Stores the name of the containing class.
TypeName "UUID" String R Identifies the data type of the data member.
Description "Unique identifier for the OrderGroup class." String O Describes the logical concept underlying the data member.
IsActive 1 Integer O This is an active data member (that is, instances may be added).
IsPersistent 1 Integer O Persist instances of this data member in the underlying data store.
IsPrimaryKey 0 Integer O This attribute is set to True (1) when the GenerateKeyDef attribute is True in the Class definition to have the Provider automatically generate the class key. This is not allowed for multi-membered keys.
IsRequired 1 Integer O This data member is required.

Running Example - Step 3

Create the new OrderForm_Id and ordergroup_id data members for the OrderFormHeader class.

'Create an instance in the Member Definition table for the first member.
   recNew.Open "MemDef/OrderFormHeader/OrderForm_Id", cnnConnection, _
    adModeWrite, adCreateOverwrite

'Set the attributes
   recNew("ClassDefName") = "OrderFormHeader"
   recNew("TypeName") = "UUID"
   recNew("Description") = "Identifier for an order form."
   recNew("IsActive") = 1
   recNew("IsPersistent") = 1
   recNew("IsPrimaryKey") = 0
   recNew("IsRequired") = 1

'Save the new row.
   recNew("__Commit") = 1
   recNew.Fields.Update

'Create an instance in the Member Definition table for the second member.
   recNew.Open "MemDef/OrderFormHeader/ordergroup_id", cnnConnection, _
    adModeWrite, adCreateOverwrite

'Set the attributes.
   recNew("ClassDefName") = "OrderFormHeader"
   recNew("TypeName") = "UUID"
   recNew("Description") = "Identifier for an order form."
   recNew("IsActive") = 1
   recNew("IsPersistent") = 1
   recNew("IsPrimaryKey") = 0
   recNew("IsRequired") = 1

'Save the new row.
   recNew("__Commit") = 1
   recNew.Fields.Update

The next step in the example is to create the key used to uniquely identify an instance of the OrderFormHeader class.


All rights reserved.