Data Model > Extending the UNICOM Intelligence Data Model > Creating a CDSC > Implementing the features of a CDSC > Implementing DDL hierarchical column
 
Implementing DDL hierarchical column
Append
When the Provider adds a column to a hierarchical table through the CDSC, it:
Uses the Source.Tables.Item property to get a reference to the CDSC's HDATA Table object.
If the column is to be added to a table at a lower level, the Provider uses the Table.Children.Item property on HDATA and its children, repeatedly, to find the table at the correct level.
Creates a new instance of a Column object and set its properties (at least Type and Name).
Calls Table.Columns.Append to add the new column to the table.
Use the Column object that is passed as a parameter to Columns.Append as a template only. The CDSC should create a new Column object and copy its properties from the Column parameter.
In the C++ skeleton project, call CColumns::InternalAdd to add the new Column object to the collection, and change the CColumns::Append function to return S_OK instead of E_NOTIMPL if it succeeds.
Delete
When the Provider deletes a column from a hierarchical table through the CDSC, it:
Uses the Source.Tables.Item property to get a reference to the CDSC's HDATA Table object.
If the column is to be deleted from a table at a lower level, the Provider uses the Table.Children.Item property on HDATA and its children, repeatedly, to find the table at the correct level.
Calls Table.Columns.Delete specifying the index of the column to be deleted.
The index parameter passed to Columns.Delete is a Variant, which contains either the name (in any mixture of upper or lower case) of the column to delete or its numeric position (counting the columns from 0).
In the C++ skeleton project, call CColumns::InternalRemove to remove the new Column object from the collection and change the CColumns::Delete function to return S_OK instead of E_NOTIMPL if it succeeds.
See also
Handling hierarchical data
Implementing the features of a CDSC