Ms > Ms Assembly Interfaces > IMsUserTransform > IMsUserTransform.Assembly
Assembly: IMetabaseObjectDescriptor;
The Assembly property determines the development environment unit or form that contains a custom class that implements model calculation method.
Executing the example requires the KONT_MODEL modeling container. The custom 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 will be used as output and factor ones respectively.
Add links to the Metabase and Ms system assemblies.
Sub UserProc;
Var
MB: IMetabase;
CrInf: IMetabaseObjectCreateInfo;
MObj: IMetabaseObject;
Model: IMsModel;
Trans: IMsFormulaTransform;
Varr: IMsVariableStub;
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 IMsVariableStub;
Trans.Outputs.Add(Varr);
VarTrans := Trans.Outputs.Item(0);
Tree := VarTrans.SlicesTree(VarTrans);
Slice := Tree.CreateSlice(1);
Selector := Model.Transform.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 IMsVariableStub;
Trans.Inputs.Add(Varr);
TransVar := Trans.Inputs.Item(0);
UserTr.Explanatories.Add(TransVar.SlicesTree(Null).CreateSlice(1));
MObj.Save;
End Sub UserProc;
After executing the example a model is created in the modeling container. A model will be calculated using the custom method that is implemented in the unit with the USER_MODEL identifier. The custom class is named My_Method. The output variable and one factor are added to the model.
See also: