IMsCalculationChainGroup.LevelParam

Fore Syntax

LevelParam: String;

Fore.NET Syntax

LevelParam: string;

Description

The LevelParam property determines parameter which sets group calculation frequency.

Comments

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

Fore Example

Executing the example requires that repository contains modeling container with the MS identifier containing metamodel with the META_LEVELPARAM identifier. The metamodel should contain the 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 collection of metamodel parameters
    Params := Metamodel.Params;
    // Clear collection of metamodel parameters
    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;
    // Look over 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 the following 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 of the 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 be also set for the 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.Ms;
Imports Prognoz.Platform.Interop.Transform;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    MsKey: uinteger;
    Metamodel: IMsMetaModel;
    mParams: IMsModelParams;
    Param: IMsModelParam;
    Chain: IMsCalculationChainEntries;
    i: Integer;
    ChainEntry: IMsCalculationChainEntry;
    Group: IMsCalculationChainGroup;
    OutputPeriod: IMsDatePeriod;
Begin
    // Get current repository
    mb := Params.Metabase;
    // Get modelling container key
    MsKey := mb.GetObjectKeyById("MS");
    // Get metamodel
    Metamodel := mb.ItemByIdNamespace["META_LEVELPARAM", MsKey].Edit() As IMsMetaModel;
    // Get collection of metamodel parameters
    mParams := Metamodel.Params;
    // Clear collection of metamodel parameters
    mParams.Clear();
    // Add a new parameter
    Param := mParams.Add();
    // Determine parameter type - frequency
    Param.ParamType := TsParamType.tsptFrequency;
    // Set default value - annual frequency
    Param.DefaultValue := DimCalendarLevelSet.dclsYear;
    // Set parameter name and identifier
    Param.Name := "Calculation frequency";
    Param.Id := "Formula_Level";
    // Get calculation chain
    Chain := Metamodel.CalculationChain;
    // Look over chain elements till the folder is not found
    For i := 0 To Chain.Count - 1 Do
        ChainEntry := Chain.Item[i];
        If ChainEntry.Type = MsCalculationChainEntryType.mccetFolder Then
            Group := ChainEntry As IMsCalculationChainGroup;
            Break;
        End If;
    End For;
    // Determine that calculation frequency of elements in folder is determined by the following 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 of the metamodel
    (Metamodel As IMetabaseObject).Save();
End Sub;

See also:

IMsCalculationChainGroup