IMsModelPeriod.IdentificationStartDateCoord

Syntax

IdentificationStartDateCoord: IMsModelCoordAttributes;

IdentificationStartDateCoord: Prognoz.Platform.Interop.Ms.IMsModelCoordAttributes;

Description

The IdentificationStartDateCoord property determines settings of the coordinate that sets sample period start date.

Comments

The coordinate is available only if the model is in the multidimensional iterator. In calculation, the coordinate is the current iteration of multidimensional iterator, in which the model is calculated.

Example

Executing the example requires that the repository contains a modeling container with the MODEL_SPACE identifier. A problem with the PROBLEM identifier and a metamodel, to which multidimensional iterator is added, are created in the container. One model is included in the multidimensional iterator. A data source for the model includes the dimension, which includes attributes with the STARTDATE and ENDDATE identifiers. Dates are stored as attribute values.

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

Sub UserProc;
Var
    Mb: IMetabase;
    Problem: IMsProblem;
    MetaModel: IMsMetaModel;
    Model: IMsModel;
    Iterator: IMsCalculationChainMultiDimIterator;
    Stub: IVariableStub;
    CalcPeriod: IMsModelPeriod;
    DateCoord: IMsModelCoordAttributes;
    OutputPeriod: IMsDatePeriod;
Begin
    
// Get model
    Mb := MetabaseClass.Active;
    Problem := Mb.ItemByIdNamespace(
"PROBLEM", Mb.GetObjectKeyById("MODEL_SPACE")).Edit As IMsProblem;
    MetaModel := Problem.MetaModel;
    Iterator := MetaModel.CalculationChain.Item(0As IMsCalculationChainMultiDimIterator;
    Model := (Iterator.Contents.Item(
0As IMsCalculationChainModel).EditModel;
    Stub := Model.Transform.Inputs.Item(
0).VariableStub;
    
// Calculation periods
    CalcPeriod := Model.Transform.Period;
    
// Sample period start
    DateCoord := CalcPeriod.IdentificationStartDateCoord;
    DateCoord.Stub := Stub;
    DateCoord.Dimension := Stub.Dimension(
1);
    DateCoord.Attributes.Add(DateCoord.Dimension.Attributes.FindById(
"STARTDATE"));
    
// Sample period end
    DateCoord := CalcPeriod.IdentificationEndDateCoord;
    DateCoord.Stub := Stub;
    DateCoord.Dimension := Stub.Dimension(
1);
    DateCoord.Attributes.Add(DateCoord.Dimension.Attributes.FindById(
"ENDDATE"));
    
// Forecasting period start
    DateCoord := CalcPeriod.ForecastStartDateCoord;
    DateCoord.Stub := Stub;
    DateCoord.Dimension := Stub.Dimension(
1);
    DateCoord.Attributes.Add(DateCoord.Dimension.Attributes.FindById(
"STARTDATE"));
    
// Forecasting period end
    DateCoord := CalcPeriod.ForecastEndDateCoord;
    DateCoord.Stub := Stub;
    DateCoord.Dimension := Stub.Dimension(
1);
    DateCoord.Attributes.Add(DateCoord.Dimension.Attributes.FindById("ENDDATE"));
    
// Unloading period
    OutputPeriod := Model.Transform.OutputPeriod As IMsDatePeriod;
    
// Clear data unloading period
    OutputPeriod.ClearPeriod;
    
// Set unloading period start and end
    OutputPeriod.Enabled := True;
    
// Unloading period start
    DateCoord := OutputPeriod.StartCoord;
    DateCoord.Stub := Stub;
    DateCoord.Dimension := Stub.Dimension(
1);
    DateCoord.Attributes.Add(DateCoord.Dimension.Attributes.FindById(
"STARTDATE"));
    
// Unloading period end
    DateCoord := OutputPeriod.EndCoord;
    DateCoord.Stub := Stub;
    DateCoord.Dimension := Stub.Dimension(
1);
    DateCoord.Attributes.Add(DateCoord.Dimension.Attributes.FindById(
"ENDDATE"));
    
// Save changes
    Model.MetabaseObject.Save;
End Sub UserProc;

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Ms;

Public Shared Sub Main(Params: StartParams);
Var
    Mb: IMetabase;
    Problem: IMsProblem;
    MetaModel: IMsMetaModel;
    Model: IMsModel;
    Iterator: IMsCalculationChainMultiDimIterator;
    Stub: IVariableStub;
    CalcPeriod: IMsModelPeriod;
    DateCoord: IMsModelCoordAttributes;
    OutputPeriod: IMsDatePeriod;
Begin
    
// Get model
    Mb := Params.Metabase;
    Problem := Mb.ItemByIdNamespace[
"PROBLEM", Mb.GetObjectKeyById("MODEL_SPACE")].Edit() As IMsProblem;
    MetaModel := Problem.MetaModel;
    Iterator := MetaModel.CalculationChain.Item[0As IMsCalculationChainMultiDimIterator;
    Model := (Iterator.Contents.Item[
0As IMsCalculationChainModel).EditModel;
    Stub := Model.Transform.Inputs.Item[
0].VariableStub;
    
// Calculation periods
    CalcPeriod := Model.Transform.Period;
    
// Sample period start
    DateCoord := CalcPeriod.IdentificationStartDateCoord;
    DateCoord.Stub := Stub;
    DateCoord.Dimension := Stub.Dimension[
1];
    DateCoord.Attributes.Add(DateCoord.Dimension.Attributes.FindById(
"STARTDATE"));
    
// Sample period end
    DateCoord := CalcPeriod.IdentificationEndDateCoord;
    DateCoord.Stub := Stub;
    DateCoord.Dimension := Stub.Dimension[
1];
    DateCoord.Attributes.Add(DateCoord.Dimension.Attributes.FindById(
"ENDDATE"));
    
// Forecasting period start
    DateCoord := CalcPeriod.ForecastStartDateCoord;
    DateCoord.Stub := Stub;
    DateCoord.Dimension := Stub.Dimension[
1];
    DateCoord.Attributes.Add(DateCoord.Dimension.Attributes.FindById(
"STARTDATE"));
    
// Forecasting period end
    DateCoord := CalcPeriod.ForecastEndDateCoord;
    DateCoord.Stub := Stub;
    DateCoord.Dimension := Stub.Dimension[
1];
    DateCoord.Attributes.Add(DateCoord.Dimension.Attributes.FindById("ENDDATE"));
    
// Unloading period
    OutputPeriod := Model.Transform.OutputPeriod As IMsDatePeriod;
    // Clear data unloading period
    OutputPeriod.ClearPeriod;
    // Set unloading period start and end
    OutputPeriod.Enabled := True;
    
// Unloading period start
    DateCoord := OutputPeriod.StartCoord;
    DateCoord.Stub := Stub;
    DateCoord.Dimension := Stub.Dimension[
1];
    DateCoord.Attributes.Add(DateCoord.Dimension.Attributes.FindById(
"STARTDATE"));
    
// Unloading period end
    DateCoord := OutputPeriod.EndCoord;
    DateCoord.Stub := Stub;
    DateCoord.Dimension := Stub.Dimension[
1];
    DateCoord.Attributes.Add(DateCoord.Dimension.Attributes.FindById(
"ENDDATE"));
    
// Save changes
    Model.MetabaseObject.Save();
End Sub;

After executing the example sample, forecasting and data unloading periods are changed for the model. Period values are taken according to the current iterator iteration and created by values of specified dimension attributes.

See also:

IMsModelPeriod