IMsUserTransform.Assembly

Syntax

Assembly: IMetabaseObjectDescriptor;

Description

The Assembly determines the development environment module or form that contains the user class that implements the model calculation method.

Example

Executing the example requires the KONT_MODEL modeling container. The user method template that contains two parameters is created in the container. The container also includes the User_Var and User_Var_Factor modeling variables that are further used as output and factor ones respectively.

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");

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 := Model.Transform.CreateSelector;

Selector.Slice := Slice;

Formula := Model.Transform.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|IMsUserTransform.ClassName