IndentName(Element: Integer; Indent: Integer): String;
Element - element of composite dimension.
Indent - index of the dimension on changing which the name of Element element was formed.
The IndentName property returns name of source dimension element used to generate name for the Element element.
NOTE. Element name is generated by changing name of the previous element of the same level. If this element contains no more element, name of the last element on the previous level is changed.
NOTE. If the composite dictionary has only one source, source name is not used to generate element names.
Executing the example requires that the repository contains a virtual cube with the Virt_Cube identifier. Cubes named Cube 1 and Cube 2 are used as data sources for this virtual cube. The first cube has three dimensions, the second one has two dimensions. Elements of each dimension have numeric names from 1 to n.
Sub Main;
Var
MB: IMetabase;
Cube: IVirtualCube;
Sources: IVirtualCubeSources;
CDim: ICompoundDimension;
CSource: ICompoundDimensionSource;
CSel, Sel: IDimSelectionSet;
FixInfo: ICubeDimensionFixInfo;
Fix: ICubeDimensionFix;
Params: IMetabaseObjectParamValues;
CDimInst: ICompoundDimensionInstance;
Elements: IDimElements;
ElementsInd: IDimElementsIndent;
Element: Integer;
Begin
MB := MetabaseClass.Active;
Cube := MB.ItemById("Virt_Cube").Bind As IVirtualCube;
Sources := Cube.Sources;
//Forming selection to open composite dimension
CDim := Cube.FactDimension As ICompoundDimension;
Sel := (New DimSelectionSetFactory.Create).CreateDimSelectionSet;
CSel := (New DimSelectionSetFactory.Create).CreateDimSelectionSet;
For Each CSource In CDim.Sources Do
Sel.Clear;
//Forming selection in accordance with selection of fixed dimension in the sources
FixInfo := Sources.FindByKey(CSource.Key).FixInfo;
For Each Fix In FixInfo Do
If Fix.Selection.SelectedCount <> 0 Then
Fix.Selection.CopyTo(Sel.Add(Fix.Instance), True);
End If;
End For;
CSel.AddCompound(CSource.Key, Sel);
End For;
//Open composite dimension
Params := (CDim As IMetabaseObject).Params.CreateEmptyValues;
Params.FindById("SELECTIONS").Value := CSel;
CDimInst := (CDim As IMetabaseObject).Open(Params) As ICompoundDimensionInstance;
//Get elements of composite dimension
Elements := (CDimInst As IDimInstance).Elements;
ElementsInd := Elements As IDimElementsIndent;
//Show information on forming element names
For Each Element In Elements.Elements Do
Debug.Write(Elements.Name(Element) + ": ");
Debug.Write("Dimension: " + ElementsInd.IndentLow(Element).ToString + " ");
Debug.WriteLine("Used element: " + ElementsInd.IndentName(Element, ElementsInd.IndentLow(Element)));
End For;
End Sub Main;
On executing this example to open composite dimension of the virtual cube, a selection is set based on selection of fixed dimensions in all cube's data sources. Development environment console displays names of composite dictionary elements and information on name generation.
Cube 1 - 1 - 1 - 1: Dimension: 0 Used element: Cube 1
Cube 1 - 1 - 1 - 2: Dimension: 3 Used element: 2
Cube 1 - 1 - 2 - 1: Dimension: 2 Used element: 2
Cube 1 - 1 - 2 - 2: Dimension: 3 Used element: 2
Cube 1 - 2 - 1 - 1: Dimension: 1 Used element: 2
Cube 1 - 2 - 1 - 2: Dimension: 3 Used element: 2
Cube 1 - 2 - 2 - 1: Dimension: 2 Used element: 2
Cube 1 - 2 - 2 - 2: Dimension: 3 Used element: 2
Cube 2 - 1 - 1: Dimension: 0 Used element: Cube 2
Cube 2 - 1 - 2: Dimension: 2 Used element: 2
Cube 2 - 1 - 3: Dimension: 2 Used element: 3
Cube 2 - 2 - 1: Dimension: 1 Used element: 2
Cube 2 - 2 - 2: Dimension: 2 Used element: 2
Cube 2 - 2 - 3: Dimension: 2 Used element: 3
This data can be explained as follows:
Cube 1 - 1 - 1 - 1: Dimension: 0 Used element: Cube 1 - the first element in the first source of composite dimension. Its name is generated from source name and names of first elements of fixed dimensions of the first source cube.
Cube 1 - 1 - 1 - 2: Dimension: 3 Used element: 2 - the second element in the first source of composite dimension. Element of the third dimension was used to generate its name. Name of the used element: 2.
...
Cube 2 - 1 - 1: Dimension: 0 Used element: Cube 2 - the first source contains no more elements. It is the first element in the second source. The name is generated from second source's name and names of first elements of fixed dimensions of the second source cube.
And so on.
See also: