IMsFormulaTransform.RefreshAttributesStructure

Syntax

RefreshAttributesStructure;

Description

The RefreshAttributesStructure method refreshes the structure of attributes of the model.

Comments

The method is relevant if the model is based on attributes.

Example

Executing the example requires a time series database with the TSDB identifier containing a model of the determinate equation with the MODEL_ATTR identifier in the internal modeling container.

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

Sub UserProc;
Var
    Mb: IMetabase;
    RubrDescr: IMetabaseObjectDescriptor;
    Rubr: IRubricator;
    MsDescr: IMetabaseObjectDescriptor;
    Model: IMsModel;
    Transform: IMsFormulaTransform;
    TransformVarables: IMsFormulaTransformVariables;
    Coord: IMsFormulaTransformCoord;
    Calc: IMsMethodCalculation;
    Period: IMsModelPeriod;
    Formula: IMsFormula;
Begin
    // Get time series database
    Mb := MetabaseClass.Active;
    RubrDescr := Mb.ItemById("TSDB");
    Rubr := RubrDescr.Bind As IRubricator;
    // Get the internal modeling container
    MsDescr := Rubr.ModelSpace;
    // Get the model
    Model := Mb.ItemByIdNamespace("MODEL_ATTR", MsDescr.Key).Edit As IMsModel;
    // Get model parameters
    Transform := Model.Transform;
    // Set the parameters for calculation of the model
    TransformVarables := Transform.Outputs;
    Coord := Transform.CreateCoord(TransformVarables.Item(0));
    Calc := Transform.CreateCalculation;
    Period := Calc.Period;
    Period.IdentificationStartDate := Model.Transform.Period.IdentificationStartDate;
    Period.IdentificationEndDate := Model.Transform.Period.IdentificationEndDate;
    Period.ForecastStartDate := Model.Transform.Period.ForecastStartDate;
    Period.ForecastEndDate := Model.Transform.Period.ForecastEndDate;
    Calc.CurrentPoint := Model.Transform.Period.IdentificationStartDate;
    // Update structure of attributes of the model
    Transform.RefreshAttributesStructure;
    // Perform calculation of the model
    Formula := Transform.FormulaItem(0);
    (Formula.Method As IMsDeterministicTransform).Execute(Calc, Coord);
    // Save changes
    (Model As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the structure of attributes of the MODEL_ATTR model is updated. The model is calculated.

See also:

IMsFormulaTransform