IMsMetaModelVisualController.GetVariableValues

Syntax

GetVariableValues(
                  Slice: IMsFormulaTransformSlice;
                  EntryKey: Integer;
                  ScenarioKeys: Array;
                  CleanIdentification: Boolean;
                  Calculation: IMsMethodCalculation;
                  Coord: IMsFormulaTransformCoord;
                  FillType: MsFillBoundType;
                  Transform: IMsFormulaTransform;
                  Var Dates: Array;
                  Var FilledDates: Array;
                  Var FilledCount: Integer;
                  Var Level: Integer;
                  Var Result: Array);

Parameters

Slice. Variable slice.

EntryKey. V.ariable key.

ScenarioKeys. Array of modeling scenario keys.

CleanIdentification. Indicates whether to clear sample period.

Calculation. Parameters of calculation of the model containing the variable.

Coord. Parameters of the variable coordinate.

FillType. Period of data receiving.

Transform. Parameters of the model containing the variable.

Dates. Array of dates for variable values.

FilledDates. Array of indicators whether variable contains date-specific value.

FilledCount. Number of non-empty variable values.

Level. Calendar frequency of the variable.

Result. Variable values.

Description

The GetVariableValues method returns variable values with dates by specified scenarios.

Comments

Available values of the CleanIdentification parameter:

The method returns execution result in the Dates, FilledDates, FilledCount, Level, Result parameters. Each element of the Dates array corresponds to the elements in the FilledDates and Result arrays.

Example

Executing the example requires that the repository contains a modeling container with the MS identifier, containing a modeling problem with the MODEL_RESETTEST_WEB identifier. This problem must contain an internal metamodel, the calculation chain of which contains at least one model.

Add links to the Metabase, Ms system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    MsObj: IMetabaseObjectDescriptor;
    Problem: IMsProblem;
    Meta: IMsMetaModel;
    MetaVisual: IMsMetaModelVisualController;
    ChainEnts: IMsCalculationChainEntries;
    ChainEl: IMsCalculationChainEntry;
    i: Integer;
    Model: IMsModel;
    Transform: IMsFormulaTransform;
    Vars: IMsFormulaTransformVariables;
    OutputVar: IMsFormulaTransformVariable;
    Slice: IMsFormulaTransformSlice;
    VarKey: Integer;
    Coord: IMsFormulaTransformCoord;
    Calc: IMsMethodCalculation;
    ScenKeys: Array Of Integer;
    Dates: Array Of DateTime;
    FilledDates: Array Of Boolean;
    FilledCount: Integer;
    Level: Integer;
    Result: Array Of Double;
Begin
    mb := MetabaseClass.Active;
    // Get modeling container
    MsObj := mb.ItemById("MS");
    // Get modeling problem
    Problem := mb.ItemByIdNamespace("MODEL_RESETTEST_WEB", MsObj.Key).Bind As IMsProblem;
    // Get metamodel
    Meta := Problem.MetaModel;
    MetaVisual := Meta.VisualController;
    // Get the first model in the calculation chain
    ChainEnts := Meta.CalculationChain;
    For i := 0 To ChainEnts.Count - 1 Do
        ChainEl := ChainEnts.Item(i);
        If ChainEl.Type = MsCalculationChainEntryType.Model Then
            Model := (ChainEl As IMsCalculationChainModel).Model;
            Break;
        End If;
    End For;
    // Get the input variable of the model
    Transform := Model.Transform;
    Vars := Transform.Outputs;
    OutputVar := Vars.Item(0);
    VarKey := OutputVar.Key;
    Slice := OutputVar.Slices.Item(0);
    // Get the parameters of the method of model calculation
    Coord := Transform.CreateCoord(OutputVar);
    // Set the parameters of calculation period of the model
    Calc := Transform.CreateCalculation;
    Calc.Period.IdentificationStartDate := model.Transform.Period.IdentificationStartDate;
    Calc.Period.IdentificationEndDate := model.Transform.Period.IdentificationEndDate;
    Calc.Period.ForecastStartDate := model.Transform.Period.ForecastStartDate;
    Calc.Period.ForecastEndDate := model.Transform.Period.ForecastEndDate;
    // Create an array of scenario keys and specify the Fact scenario there
    ScenKeys := New Integer[1];
    ScenKeys[0] := -1;
    // Get input variable values 
    MetaVisual.GetVariableValues(Slice, VarKey, ScenKeys, True, Calc, Coord,
        MsFillBoundType.EndForecast, Transform, Dates, FilledDates, FilledCount, Level, Result);
    // Output values to console window  
    For i := 0 To Dates.Length - 1 Do
        Debug.Write(Dates[i]);
        Debug.Write(" - ");
        Debug.WriteLine(Result[i])
    End For;
End Sub UserProc;

After executing the example the console window displays input variable values for the first model in the problem calculation chain.

See also:

IMsMetaModelVisualController