| Visual Basic (Declaration) | |
|---|---|
Public Overloads Function AddCalculatedColumn( _ ByVal DataTable As TDataTable, _ ByVal ColumnName As String, _ ByVal ColumnType As Type, _ ByVal SourceColumnName As String, _ ByVal SourceColumnFormat As String _ ) As TDataColumn | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As TOLAPCube Dim DataTable As TDataTable Dim ColumnName As String Dim ColumnType As Type Dim SourceColumnName As String Dim SourceColumnFormat As String Dim value As TDataColumn value = instance.AddCalculatedColumn(DataTable, ColumnName, ColumnType, SourceColumnName, SourceColumnFormat) | |
| C# | |
|---|---|
public TDataColumn AddCalculatedColumn( TDataTable DataTable, string ColumnName, Type ColumnType, string SourceColumnName, string SourceColumnFormat ) | |
| Managed Extensions for C++ | |
|---|---|
public: TDataColumn* AddCalculatedColumn( TDataTable* DataTable, string* ColumnName, Type* ColumnType, string* SourceColumnName, string* SourceColumnFormat ) | |
| C++/CLI | |
|---|---|
public: TDataColumn^ AddCalculatedColumn( TDataTable^ DataTable, String^ ColumnName, Type^ ColumnType, String^ SourceColumnName, String^ SourceColumnFormat ) | |
Parameters
- DataTable
- Defines the table to put the new field into.
- ColumnName
- Defines the name of the new field.
- ColumnType
- Defines the type of the new column.
- SourceColumnName
- If it is defined, the method creates an auto-calculated field that computes its value from another field and doesn’t require OnCalculateField event. Otherwise it creates event-calculated field which requires OnCalculateField event handler to be cumputed.
- SourceColumnFormat
- If defined, specifies the format mask to apply to the source column to get the resulting value for the calculated column.
Return Value
Returns either a matching column from the specified table or, if there's no match, creates and returns a new one.Adds a new calculated column to a data table, when the cube is created in run time. The data table to add the column to can be defined with System.Data.DataTable object or TDataTable object.
The method searches first the data schema for the specified table and then the table for the specified column with the specified type of data, and if there is no match, they are created (see AddDataTable). Note that a field should have a unique name.
If the optional SourceColumnName parameter is passed, then the method creates an auto-calculated field that computes its value from another field and doesn't require TOLAPCube.OnCalculateField event. Otherwise it creates an event-calculated field. For details about calculated fields see Calculated fields. Using TOLAPCube.OnCalculateFields event.
After the column is added into the table, it may be calculated in TOLAPCube.OnCalculateField event handler, and used as a regular field in the cube.
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family