IMsModelPeriod.IdentificationStartDateParam

Syntax

IdentificationStartDateParam: IMsModelParamAttributes;

Description

The IdentificationStartDateParam property determines binding settings for the parameter that sets sample period start date.

Example

Executing the example requires that the repository contains a modeling container with the MODEL_SPACE identifier. A problem with the PROBLEM identifier, a metamodel and a model are created in the container. Parameters with the I_START, I_END, F_START, F_END identifiers are created in the metamodel. All parameters send selection and are linked with calendar dictionary.

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

Sub UserProc;
Var
    Mb: IMetabase;
    Problem: IMsProblem;
    MetaModel: IMsMetaModel;
    Model: IMsModel;
    MParams: IMsModelParams;
    CalcPeriod: IMsModelPeriod;
    OutputPeriod: IMsDatePeriod;
Begin
    
// Get model
    Mb := MetabaseClass.Active;
    Problem := Mb.ItemByIdNamespace(
"PROBLEM", Mb.GetObjectKeyById("MODEL_SPACE")).Edit As IMsProblem;
    MetaModel := Problem.MetaModel;
    Model := (MetaModel.CalculationChain.Item(
0As IMsCalculationChainModel).EditModel;
    MParams := MetaModel.Params;
    
// Calculation periods
    CalcPeriod := Model.Transform.Period;
    CalcPeriod.IdentificationStartDateParam.Parameter := MParams.FindById(
"I_START");
    CalcPeriod.IdentificationEndDateParam.Parameter := MParams.FindById(
"I_END");
    CalcPeriod.ForecastStartDateParam.Parameter := MParams.FindById(
"F_START");
    CalcPeriod.ForecastEndDateParam.Parameter := MParams.FindById(
"F_END");
    SetAttribute(CalcPeriod.IdentificationStartDateParam);
    SetAttribute(CalcPeriod.IdentificationEndDateParam);
    SetAttribute(CalcPeriod.ForecastStartDateParam);
    SetAttribute(CalcPeriod.ForecastEndDateParam);
    
// Loading period
    OutputPeriod := Model.Transform.OutputPeriod As IMsDatePeriod;
    
// Clear data loading period
    OutputPeriod.ClearPeriod();
    
// Set loading period start and end
    OutputPeriod.Enabled := True;
    OutputPeriod.StartParam.Parameter := MParams.FindById(
"F_START");
    OutputPeriod.EndParam.Parameter := MParams.FindById(
"F_END");
    SetAttribute(OutputPeriod.StartParam);
    SetAttribute(OutputPeriod.EndParam);
    
// Save changes
    Model.MetabaseObject.Save;
End Sub UserProc;

Sub SetAttribute(DateParam: IMsModelParamAttributes);
Var
    Dim: IDimInstance;
Begin
    Dim := DateParam.Parameter.LinkedObject.Open(
NullAs IDimInstance;
    DateParam.ClearAttributes;
    DateParam.Attributes.Add(Dim.Attributes.FindById(
"START_DATE").Attribute);
End Sub SetAttribute;

After executing the example sample, forecasting and data loading periods are changed for the model. Period values are taken from metamodel parameters and created by values of the START_DATE attribute of the elements selected in calendar dictionaries.

See also:

IMsModelPeriod