IEaxDataAreaHierarchies.SaveToMetabase

Fore Syntax

SaveToMetabase(Key: Integer; Object: IMetabaseObjectDescriptor);

Fore.NET Syntax

SaveToMetabase(Key: uinteger; Object: Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptor);

Parameters

Key. Key of alternative hierarchy.

Object. Object to which alternative hierarchy is stored.

Description

The SaveToMetabase method saves the specified alternative hierarchy.

Comments

Object, to which alternative hierarchy is stored, should be of the Constructed dictionary type.

Fore Example

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.

Fore.NET Example

The requirements and result of the Fore.NET Example execution match with those in the Fore Example.

Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Express;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Express: IEaxAnalyzer;
    DArea: IEaxDataArea;
    Hiers: IEaxDataAreaHierarchies;
    Hier: IEaxDataAreaHierarchy;
    CrInfo: IMetabaseObjectCreateInfo;
    MObj: IMetabaseObjectDescriptor;
Begin
    // Get repository
    MB := Params.Metabase;
    // 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 As integer;
        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;

See also:

IEaxDataAreaHierarchies