CoordToText(Coord: IMatrixCoord; [FactIndex: Integer = -1]): String;
CoordToText(Coord: IMatrixCoord; FactIndex: integer): string;
Coord. Coordinate corresponding to element in data source or data consumer.
FactIndex. Index of the factor, by which value must be obtained.
The CoordToText property returns string view of the element, to which the coordinate corresponds in the data source or data consumer.
Executing the example requires that the repository contains a multidimensional calculation on DB server with the MDCALC identifier.
Add links to the Cubes, Dimensions, Matrix, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MDInst: IMDCalculationInstance;
Source: IMDCalculationSourceInstance;
Slices: IMDCalculationSlicesInstance;
Slice: IMDCalculationSliceInstance;
Coord: IMatrixCoord;
i, j: Integer;
Begin
// Get current repository
MB := MetabaseClass.Active;
// Get multidimensional calculation on server
MDInst := MB.ItemById("MDCALC").Open(Null) As IMDCalculationInstance;
// Get sources
Source := MDInst.Sources.Item(0);
// Get slices
Slices := Source.Slices;
Coord := Source.NewCoord;
//In all slices, except for the first, select first elements
For i := 1 To Slices.Count - 1 Do
Coord.Item(i) := 0;
End For;
Slice := Source.Slices.Item(0);
j := Slice.Dimension.Elements.Count;
//View all elements of the first slice
For i := 0 To j - 1 Do
Coord.Item(0) := i;
Debug.WriteLine(Source.CoordToText(Coord));
End For;
End Sub UserProc;
After executing the example the development environment console displays string values of elements obtained by the first data source slice. The first elements are selected by the rest of non-fixed slices.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Matrix;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MDInst: IMDCalculationInstance;
Source: IMDCalculationSourceInstance;
Slices: IMDCalculationSlicesInstance;
Slice: IMDCalculationSliceInstance;
Coord: IMatrixCoord;
i, j: Integer;
Begin
// Get current repository
MB := Params.Metabase;
// Get multidimensional calculation on server
MDInst := MB.ItemById["MDCALC"].Open(Null) As IMDCalculationInstance;
// Get sources
Source := MDInst.Sources.Item[0];
// Get slices
Slices := Source.Slices;
Coord := Source.NewCoord();
// Select first slice elements
For i := 1 To Slices.Count - 1 Do
Coord.Item[i] := 0;
End For;
Slice := Source.Slices.Item[0];
j := Slice.Dimension.Elements.Count;
// View all elements of the first slice
For i := 0 To j - 1 Do
Coord.Item[0] := i;
System.Diagnostics.Debug.WriteLine(Source.CoordToText(Coord, i));
End For;
End Sub;
See also: