Creating a New Class Relation Member

This section describes how to map a member of a parent class to a member of its child class. This allows the mapped parent class member to be seen and populated by the child class. When a class relation is created, a key from the parent class is automatically mapped to the child class (as a non-key member) but not persisted in the child class. In this example, since the implicitly mapped parent class key is also used as part of the child class key, and all members of a key must be persisted, this behavior must be overridden. Explicitly creating the relation member allows the persistence of the member to be set.

The relation between the classes must already be defined. In addition, the classes must contain the respective data members prior to creating the relation member.

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

Our running example (which originated in Creating a New Class) concludes by creating a new relation member mapping the ordergroup_id data members of the OrderFormHeader and OrderGroup classes.

The following table lists the required attributes and values in the Relation Member table for the ordergroup_id member relation. Optional attributes are not shown. In the R/O column, R = required, O = optional.

Attribute Name Attribute Value Type R/O Purpose
RelationName "OrderGroupToOrderFormHeader " String R Identifies the class relation.
ParentMemName "ordergroup_id" String R Identifies the name of the parent class member.
ChildMemName "ordergroup_id" String R Identifies the name of the child class member.
Description "OrderGroup.ordergroup_id to OrderFormHeader.ordergroup_id relation member." String O Describes the logical concept underlying the relation.

Running Example - Step 7

Create a relation member mapping the ordergroup_id members of the OrderFormHeader and OrderGroup classes and save the updated schema.

'Create an instance in the Relation Member Definition table.
   recNew.Open _
   "RelMem/OrderGroupToOrderFormHeader/ordergroup_id/ordergroup_id", _
    cnnConnection, adModeWrite, adCreateOverwrite

'Set the attributes
   recNew("ParentMemName") = "ordergroup_id"
   recNew("ChildMemName") = "ordergroup_id"
   recNew("Description") = "OrderGroup.ordergroup_id to " & _
    "OrderFormHeader.ordergroup_id relation member."

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

'Commit the changes to the Data Warehouse schema.
   cmdCommand.CommandText = "CommitSchema"
   cmdCommand.Execute

'Turn off "Schema Change" mode.
   cmdCommand.CommandText = "SchemaMode=0"
   cmdCommand.Execute

'Close the connection.
   cnnConnection.Close

'Release the objects.
   Set recNew = Nothing
   Set cmdCommand = Nothing
   Set cnnConnection = Nothing

This completes the example of extending the Data Warehouse to include the OrderFormHeader class.

If the OrderFormHeader class was not a pre-existing Data Warehouse class, custom log import tasks would have to be created to populate the new class with user data. Additionally, custom calculations would have to be created to access the new structures for reporting.


All rights reserved.