IMsExpressionEdit.AddAttribute

Syntax

AddAttribute(Value: IMetaAttribute);

Parameters

Value. Attribute of time series database.

Description

The AddAttribute method adds the attribute, which values are used to create series in the component.

Comments

The Value parameter cannot have the Null value. After executing the method the added attribute values are available in the component and used for series creation.

The number of attributes added for use can be obtained in the IMsExpressionEdit.GetAttributeCount property.

Example

Executing the example requires that the repository contains a form, a button named Button1 on it and the MsExpressionEdit component named MsExpressionEdit1. The repository is supposed to have a time series database with the FC_COMM identifier. The modeling container of this database contains a model (determinate equation) with the MODEL_DETERM identifier. The Country mandatory attribute, containing names of countries, is added to the attributes of the database.

The example is a handler of the OnClick event for the Button1 button.

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

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    MB: IMetabase;
    Rubr: IRubricator;
    Model: IMsModel;
    Transform: IMsFormulaTransform;
    Formula: IMsFormula;
    Determ: IMsDeterministicTransform;
    TransVar: IMsFormulaTransformVariable;
Begin
    MB := MetabaseClass.Active;
    Rubr := MB.ItemById("FC_COMM").Bind As IRubricator;
    Model := MB.ItemByIdNamespace("MODEL_DETERM", Rubr.ModelSpace.Key).Bind As IMsModel;
    Transform := Model.Transform;
    Formula := Transform.FormulaItem(0);
    Determ := Formula.Method As IMsDeterministicTransform;
    TransVar := Transform.Outputs.Item(0);
    //Settings of the MsExpressionEdit component parameters
    If MsExpressionEdit1.GetAttributeCount > 0 Then
        MsExpressionEdit1.ClearAttributes;
    End If;
    MsExpressionEdit1.Rubricator := Rubr;
    MsExpressionEdit1.FormulaTransform := Transform;
    MsExpressionEdit1.FormulaTermList := Determ.Operands;
    MsExpressionEdit1.Expression := Determ.Expression;
    MsExpressionEdit1.AddAttribute(Rubr.Facts.Attributes.FindById("COUNTRY"));
    MsExpressionEdit1.AddAttribute(Rubr.Facts.Attributes.FindById("DL"));
End Sub Button1OnClick;

After executing the example, the MsExpressionEdit1 component is set up for working with the MODEL_DETERM model equation. MsExpressionEdit will have all model operands and values of the Period and Countries attributes.

See also:

IMsExpressionEdit