IMsExpressionEdit.AddAttribute

Fore Syntax

AddAttribute(Value: IMetaAttribute);

Fore.NET Syntax

AddAttribute(Value: Prognoz.Platform.Interop.Rds.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 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. 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.

Add links to the Metabase, Cubes, 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;

On the button click the MsExpressionEdit1 component is set for working with the MODEL_DETERM model equation. All operands of the model and the Period and Countries attribute values will be available in the MsExpressionEdit property.

See also:

IMsExpressionEdit