GetIndentInfo(Element: Integer; Indent: Integer; Var: Level: Integer; Var Name: String);
Element - element of composite dimension.
Indent - index of the dimension on changing which the name of Element element was formed.
Level - variable to which the method saves value of source dimension level which contains the element used to form Element's name.
Name - variable to which the method saves name of source dimension element used to form Element's name.
The GetIndentInfo method returns information on source dimension element used to form the Element element name.
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;
Lvl, Element: Integer;
n: String;
Begin
MB := MetabaseClass.Active;
Cube := MB.ItemById("Virt_Cube").Bind As IVirtualCube;
Sources := Cube.Sources;
//Create selection for opening 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;
//Create selection according to fixed dimensions selection in data 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 composite dimension elements
Elements := (CDimInst As IDimInstance).Elements;
ElementsInd := Elements As IDimElementsIndent;
//Display information about creating element names
For Each Element In Elements.Elements Do
Debug.Write(Elements.Name(Element) + ": ");
ElementsInd.GetIndentInfo(Element, 1, Lvl, n);
Debug.WriteLine("Уровень исходного элемента: " + Lvl.ToString + "; Source element name: " + n);
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 shows information on elements of the first dimension used to form names of composite dimension.
See also: