Value(RowIndex: Integer; ColIndex: Integer): Variant;
RowIndex — index of element row.
ColIndex — index of element column. The number of columns matches the number of attributes created in the dictionary.
The Value property returns value of loader element stored in row with the RowIndex index and column with the ColIndex index.
If you set value of the element for the column, number of which exceeds the number of dictionary attributes by 1, this value is regarded as parent element key.
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: 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;
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.
See also: