IMsCalculationChainEntry.InheritModelPeriod

Fore Syntax

InheritModelPeriod: Boolean;

Fore.NET Syntax

InheritModelPeriod: boolean;

Description

The InheritModelPeriod property determines whether element of chain inherits calculation period and frequency from parent element.

Comments

Available values:

Fore Example

Executing the example requires that the repository contains a modeling container with the MODELLING_CONTAINER identifier. This container contains a metamodel with the META_MODEL identifier and a model with the MODEL identifier.

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

Sub UserInherit;
Var
    Metabase: IMetabase;
    ModelspaceDescr: IMetabaseObjectDescriptor;
    MetaModel: IMsMetaModel;
    CalculationChain, FolderCont: IMsCalculationChainEntries;
    Folder: IMsCalculationChainFolder;
    Period: IMsModelPeriod;
    Model: IMsModel;
    CalcModel: IMsCalculationChainModel;
Begin
    Metabase := MetabaseClass.Active;
    // Get modeling container
    ModelspaceDescr := Metabase.ItemById("MODELING_CONTAINER");
    // Get metamodel
    MetaModel := Metabase.ItemByIdNamespace("META_MODEL", ModelspaceDescr.Key).Edit As IMsMetaModel;
    // Get calculation chain and create a folder in it
    CalculationChain := MetaModel.CalculationChain;
    Folder := CalculationChain.AddFolder("Initial data");
    // Set parameters of folder calculation
    Folder.Level := DimCalendarLevel.Year;
    Period := Folder.Period;
    Period.ForecastEndDate := DateTime.ComposeDay(20191231);
    Period.ForecastStartDate := DateTime.ComposeDay(201011);
    Period.IdentificationEndDate := DateTime.ComposeDay(20091231);
    Period.IdentificationStartDate := DateTime.ComposeDay(200011);
    FolderCont := Folder.Contents;
    // Get model
    Model := Metabase.ItemByIdNamespace("MODEL", ModelspaceDescr.Key).Bind As IMsModel;
    // Add a model to folder
    CalcModel := FolderCont.AddModel(Model);
    // Specify that model inherits period and calculation frequency from folder
    CalcModel.InheritModelPeriod := True;
    // Save changes
    (MetaModel As IMetabaseObject).Save;
End Sub UserInherit;

After executing the example the folder that contains the model is added to the metamodel chain. This folder is regarded as a group. The period and calculation frequency are assigned for it. The model that is placed in the folder inherits the period and calculation frequency of 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;

Public Shared Sub Main(Params: StartParams);
Var
    Metabase: IMetabase;
    ModelspaceDescr: IMetabaseObjectDescriptor;
    MetaModel: IMsMetaModel;
    CalculationChain, FolderCont: IMsCalculationChainEntries;
    Folder: IMsCalculationChainFolder;
    Period: IMsModelPeriod;
    Model: IMsModel;
    CalcModel: IMsCalculationChainModel;
Begin
    Metabase := Params.Metabase;
    // Get modeling container
    ModelspaceDescr := Metabase.ItemById["MODELING_CONTAINER"];
    // Get metamodel
    MetaModel := Metabase.ItemByIdNamespace["META_MODEL", ModelspaceDescr.Key].Edit() As IMsMetaModel;
    // Get calculation chain and create a folder in it
    CalculationChain := MetaModel.CalculationChain;
    Folder := CalculationChain.AddFolder("Source data");
    // Set parameters of folder calculation
    Folder.Level := DimCalendarLevel.dclYear;
    Period := Folder.Period;
    Period.ForecastEndDate := DateTime.Parse("2019.12.31");
    Period.ForecastStartDate := DateTime.Parse("2010.1.1");
    Period.IdentificationEndDate := DateTime.Parse("2009.12.31");
    Period.IdentificationStartDate := DateTime.Parse("2000.1.1");
    FolderCont := Folder.Contents;
    // Get model
    Model := Metabase.ItemByIdNamespace["MODEL", ModelspaceDescr.Key].Bind() As IMsModel;
    // Add a model to folder
    CalcModel := FolderCont.AddModel(Model);
    // Specify that model inherits period and calculation frequency from folder
    CalcModel.InheritModelPeriod := True;
    // Save changes
    (MetaModel As IMetabaseObject).Save();
End Sub;

See also:

IMsCalculationChainEntry