IMsUserTransform.Explanatories

Syntax

Explanatories: IMsFormulaTermList;

Description

The Explanatories property returns an object that contains the collection of terms used in model calculation.

Example

Sub Main;

Var

MB: IMetabase;

CrInf: IMetabaseObjectCreateInfo;

MObj: IMetabaseObject;

Model: IMsModel;

Trans: IMsFormulaTransform;

Varr: IMsVariable;

VarTrans: IMsFormulaTransformVariable;

Tree: IMsFormulaTransformSlicesTree;

Slice: IMsFormulaTransformSlice;

Selector: IMsFormulaTransformSelector;

Formula: IMsFormula;

UserTr: IMsUserTransform;

TransVar: IMsFormulaTransformVariable;

Begin

MB := MetabaseClass.Active;

CrInf := Mb.CreateCreateInfo;

CrInf.ClassId := MetabaseObjectClass.KE_CLASS_MSMODEL;

CrInf.Id := "User_Model";

CrInf.Name := "User_Model";

CrInf.Parent := Mb.ItemById("KONT_MODEL");

CrInf.Permanent := False;

MObj := Mb.CreateObject(CrInf).Edit;

Model := MObj As IMsModel;

Trans := Model.Transform;

Varr := MB.ItemByIdNamespace("User_Var", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;

Model.Output.Add(Varr);

VarTrans := Trans.Outputs.Item(0);

Tree := VarTrans.SlicesTree(VarTrans);

Slice := Tree.CreateSlice(1);

Selector := Trans.CreateSelector;

Selector.Slice := Slice;

Formula := Trans.Transform(Selector);

Formula.Kind := MsFormulaKind.User;

Formula.Level := DimCalendarLevel.Year;

UserTr := Formula.Method As IMsUserTransform;

UserTr.Assembly := Mb.ItemById("UserMethod_Class");

UserTr.ClassName := "My_Method";

Varr := MB.ItemByIdNamespace("User_Var_Factor", MB.ItemById("KONT_MODEL").Key).Bind As IMsVariable;

Model.Input.Add(Varr);

TransVar := Model.Transform.Inputs.Item(0);

UserTr.Explanatories.Add(TransVar.SlicesTree(Null).CreateSlice(1));

MObj.Save;

End Sub Main;

After executing the example a model is created in the modeling container. For model calculation the user method that is implemented in the module with the User_Model identifier is used. The user class is named My_Method. The output variable and one factor are added to the model.

See also:

IMsUserTransform