SaveToMetabase(Key: Integer; Object: IMetabaseObjectDescriptor);
Key. Key of alternative hierarchy.
Object. Object to which alternative hierarchy is stored.
The SaveToMetabase method saves the specified alternative hierarchy.
Object, to which alternative hierarchy is stored, should be of the Constructed dictionary type.
Executing the example requires that repository contains an express report with the EXPRESS_ELEMENT identifier. This report should contain dimension with custom alternative hierarchy. The repository should also contain a folder with the DATAAREAHIERARCHIES identifier.
Add links to the Dimensions, Express, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Express: IEaxAnalyzer;
DArea: IEaxDataArea;
Hiers: IEaxDataAreaHierarchies;
Hier: IEaxDataAreaHierarchy;
CrInfo: IMetabaseObjectCreateInfo;
MObj: IMetabaseObjectDescriptor;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get express report
Express := MB.ItemById("EXPRESS_ELEMENT").Bind As IEaxAnalyzer;
// Get data source slice
DArea := Express.DataArea;
// Get collection of alternative hierarchies
Hiers := DArea.Hierarchies;
// Save the first alternative hierarchy
If Hiers.Count > 0 Then
Hier := Hiers.Item(0);
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_CUSTOMDIM;
CrInfo.Name := "Alternative hierarchy for dictionary '" +
Hier.Selection.Dimension.Name + "'";
CrInfo.Parent := MB.ItemById("DATAAREAHIERARCHIES");
MObj := MB.CreateObject(CrInfo);
Hiers.SaveToMetabase(Hier.Key, MObj);
End If;
End Sub UserProc;
After executing the example the dictionary used to build custom alternative hierarchy is saved to the DATAAREAHIERARCHIES folder.
See also: