IMsCalculationChainGroup.LevelParam

Syntax

LevelParam: String;

Description

The LevelParam property determines the parameter, which sets group calculation frequency.

Comments

To set directly calculation frequency, use the IMsCalculationChainGroup.Level property.

Example

Executing the example requires that the repository contains a modeling container with the MS identifier containing a metamodel with the META_LEVELPARAM identifier. This metamodel must contain a folder.

Add links to the Dimensions, Metabase, Ms, Transform system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    MsKey: Integer;
    Metamodel: IMsMetaModel;
    Params: IMsModelParams;
    Param: IMsModelParam;
    Chain: IMsCalculationChainEntries;
    i: Integer;
    ChainEntry: IMsCalculationChainEntry;
    Group: IMsCalculationChainGroup;
    OutputPeriod: IMsDatePeriod;
Begin
    // Get current repository
    mb := MetabaseClass.Active;
    // Get modelling container key
    MsKey := mb.GetObjectKeyById("MS");
    // Get metamodel
    Metamodel := mb.ItemByIdNamespace("META_LEVELPARAM", MsKey).Edit As IMsMetaModel;
    // Get metamodel parameters collection
    Params := Metamodel.Params;
    // Clear metamodel parameters collection
    Params.Clear;
    // Add a new parameter
    Param := Params.Add;
    // Determine parameter type - frequency
    Param.ParamType := TsParamType.Frequency;
    // Set default value - annual frequency
    Param.DefaultValue := DimCalendarLevelSet.Year;
    // Set parameter name and identifier
    Param.Name := "Calculation frequency";
    Param.Id := "Formula_Level";
    // Get calculation chain
    Chain := Metamodel.CalculationChain;
    // Parse chain elements till the folder is not found
    For i := 0 To Chain.Count - 1 Do
        ChainEntry := Chain.Item(i);
        If ChainEntry.Type = MsCalculationChainEntryType.Folder Then
            Group := ChainEntry As IMsCalculationChainGroup;
            Break;
        End If;
    End For;
    // Determine that calculation frequency of elements in folder is determined by parameter
    Group.LevelParam := "Formula_Level";
    // Set data loading period for elements in folder
    OutputPeriod := Group.OutputPeriod As IMsDatePeriod;
    OutputPeriod.Start := DateTime.Parse("01.01.2016");
    OutputPeriod.End_ := DateTime.Parse("01.01.2020");
    // Save changes in metamodel
    (Metamodel As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the parameter determining calculation frequency will be set for the folder in calculation chain. Data loading period will also be set for the folder.

See also:

IMsCalculationChainGroup