The RelatedColumn property of a clsColumn identifies a column to which the column is related.
Read/write for columns with a SubClassType of sbclsRegular whose IsKey property is False, read-only for all others.
For columns with a SubClassType of sbclsRegular whose IsKey property is set to True and for columns with a SubClassType of sbclsNested, this property returns an empty string.
The functionality of the RelatedColumn property differs depending on the context of its usage:
- The RelatedColumn property is used to relate a column in a nested table to a column in the case table (that is, the parent table) of the data mining model. In this case, the column's IsParentKey property is set to True.
- The RelatedColumn property is used to define hierarchical relationships between columns. For example, you can use it to define that the Region column is related to the State column, the State column is related to the City column, and so on. For another example, consider a case set involving customer purchases. If ProductName is a column defined in the model, a column called ProductType can have its RelatedColumn property set to the ProductName column to indicate that its information is related to the ProductName column.
- The SpecialFlag property is used with the RelatedColumn property. Consider the example in which a column is defined using the SpecialFlag property to contain a probability. In this case, the RelatedColumn property is used to determine which column the probability is based on. If a column is defined that is related to the CreditRisk column and contains a probability, the column would contain the numeric probability of a given credit for a given case.
The following example creates a key column in the case table for a mining model. It then creates a nested table based on three different tables and establishes the relationships between them (that is, their joins). Finally, it establishes a key column within this nested table and relates it to the key column in the case table.
'Define the key column for the case table. Set dsoColumn = dsoDmm.Columns.AddNew("KeyColumn") dsoColumn.SourceColumn = "Key" dsoColumn.DataType = adInteger dsoColumn.IsKey = True 'Define a nested table and relate the tables it is based on in a join. Set dsoNestedCol = dsoDmm.Columns.AddNew("Products", sbclsNested) dsoNestedCol.FromClause = "Sales, SalesReps, Products" dsoNestedCol.JoinClause = "Sales.SalesRep = SalesReps.Name " & _ "AND Sales.Product = Products.Product" dsoNestedCol.Filter = "" 'Create a parent key column for the nested table and relate it to a column in the case table. Set dsoColumn = dsoNestedCol.Columns.AddNew("CustomerID") dsoColumn.SourceColumn = "CustId" dsoColumn.DataType = adInteger dsoColumn.IsParentKey = True dsoColumn.RelatedColumn = "KeyColumn"