ForeMethod: IForeMethod;
The ForeMethod property determines the global user method used for model calculation.
If the global user method is determined, values of the IMsUserTransform.Assembly and IMsUserTransform.ClassName properties are reset.
Executing the example requires the global parameters area that contains user methods. Also, the repository should include a modeling container with the CONT_MODEL identifier that contains a model with the MODEL identifier.
Sub Main;
Var
mb: IMetabase;
Shp: ISharedParams;
contModel: IMetabaseObjectDescriptor;
model: IMsModel;
formula: IMsFormula;
userM: IMsUserTransform;
transform: IMsFormulaTransform;
f: IForeMethod;
Begin
mb := MetabaseClass.Active;
contModel := mb.ItemById("CONT_MODEL");
model := mb.ItemByIdNamespace("MODEL", contModel.Key).Edit As IMsModel;
transform := model.Transform;
formula := transform.FormulaItem(0);
formula.Kind := MsFormulaKind.User;
userM := formula.Method As IMsUserTransform;
Shp := mb.SpecialObject(MetabaseSpecialObject.SharedParams).Bind As ISharedParams;
f := Shp.Methods.Item(0);
userM.ForeMethod := f;
(model As IMetabaseObject).Save;
End Sub Main;
After executing the example the MODEL model uses the first user method from global parameters area for calculation.
See also: