IDimBlockLoader.ColCount

Syntax

ColCount: Integer;

Description

The ColCount property returns the number of data-containing column in the loader. The number of columns matches the number of attributes created in the dictionary.

Example

Sub Makros_1(User: IUserDimension; Builder: IDimBuilder; Par: IMetabaseObjectParamValues);

Var

Mb: IMetabase;

Db: IDatabaseInstance;

Comm: IDalCommand;

Cur: IDalCursor;

Fields: IDalCursorFields;

DimBlock: IUserDimBlock;

BlockRoot, Block: IDimBlockLoader;

i, j: integer;

Begin

Mb:=MetabaseClass.Active;

Db:=MB.ItemById("S_X_D").Open(Null) As IDatabaseInstance;

Comm:=Db.Connection.CreateCommand("Select id, name, orders, parent_id From T_SEP Order by parent_id");

Cur:=Comm.CreateCursor;

Fields:=Cur.Fields;

DimBlock:=User.Blocks.Item(0);

BlockRoot:=Builder.CreateRootBlockLoader(DimBlock.Key);

Block:=Builder.CreateBlockLoader(DimBlock.Key,DimBlock.Key);

While Not Cur.Eof Do

If (Fields.Item(3).Value As Double) = 0 Then

i := BlockRoot.AddRow;

BlockRoot.Value(i, 0) := Fields.Item(0).Value As Double;

BlockRoot.Value(i, 1) := Fields.Item(1).Value As String;

BlockRoot.Value(i, 2) := Fields.Item(2).Value As Double;

Else

i := Block.AddRow;

Block.Value(i, 0) := Fields.Item(0).Value As Double;

Block.Value(i, 1) := Fields.Item(1).Value As String;

Block.Value(i, 2) := Fields.Item(2).Value As Double;

Block.Value(i, 3) := Fields.Item(3).Value As Double;

End If;

Cur.Next;

End While;

i:=BlockRoot.RowCount;

j:=BlockRoot.ColCount;

End Sub Makros_1;

This example is a macro for calculated dictionary. The dictionary is based on the T_SEP table stored in the S_X_D database. After executing the example the "i' variable contains the number of loaded top-level rows, and the "j" variable shows the number of data-containing columns in the loader.

See also:

IDimBlockLoader