IMsFormulaTransformVariables.AddParamVariable

Syntax

AddParamVariable(Value: String): IMsFormulaTransformVariable;

Parameters

Value. Identifier that is assigned to the variable.

Description

The AddParamVariable method adds a variable to the collection based on parameter.

Example

Executing the example requires that the repository contains a modeling container with the CONT_M identifier. The model with the Model identifier that uses the determinate equation for calculation, must be present in this container.

Sub UserProc;
Var
    mb: IMetabase;
    cm: IMetabaseObjectDescriptor;
    Model: IMsModel;
    Formula: IMsFormula;
    Determ: IMsDeterministicTransform;
    Transform: IMsFormulaTransform;
    Term: IMsFormulaTerm;
    InputsVar: IMsFormulaTransformVariables;
    ParamVar: IMsFormulaTransformVariable;
    Slice: IMsFormulaTransformSlice;
Begin
    mb := MetabaseClass.Active;
    cm := mb.ItemById("CONT_M");
    Model := mb.ItemByIdNamespace("Model", cm.Key).Edit As IMsModel;
    Transform := Model.Transform;
    Formula := Transform.FormulaItem(0);
    Determ := Formula.Method As IMsDeterministicTransform;
    InputsVar := Transform.Inputs;
    ParamVar := InputsVar.AddParamVariable("VAR_PARAM");
    Slice := ParamVar.Slices.Add(Null);
    Term := Determ.Operands.Add(Slice);
    Determ.Expression.AsString := "10 * " + Term.TermToInnerText;
    (Model As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the VAR_PARAM variable that is a parameter is added to the input model variable collection. The given parameter is used in the model calculation formula.

See also:

IMsFormulaTransformVariables