Assign(TermInfo: IMsFormulaTermInfo);
TermInfo - term parameters that are necessary to set for this term.
The Assign method sets parameters of the current term, according to the TermInfo parameters. On calling this method, all term properties, except Slice are set.
Executing the example requires that the repository contains a modeling container with the KONT_MODEL identifier. This container includes a modeling problem with the New_NonLinReg identifier, that uses the method of non-linear regression for calculation. Also, the container includes the modeling variable Var_Factor1 that is added to the model.
Sub Main;
Var
MB: IMetabase;
Kont: IMetabaseObjectDescriptor;
MObj: IMetabaseObject;
Model: IMsModel;
Trans: IMsFormulaTransform;
Varr: IVariableStub;
TransVar: IMsFormulaTransformVariable;
Slice: IMsFormulaTransformSlice;
NonLinear: IMsNonLinearRegressionTransform;
Oper: IMsFormulaTermList;
Term: IMsFormulaTerm;
Info: IMsFormulaTermInfo;
Begin
MB := MetabaseClass.Active;
Kont := MB.ItemById("KONT_MODEL");
MObj := MB.ItemByIdNamespace("New_NonLinReg", Kont.Key).Edit;
Model := MObj As IMsModel;
Trans := Model.Transform;
Varr := MB.ItemByIdNamespace("Var_Factor1", Kont.Key).Bind As IVariableStub;
TransVar := Trans.Inputs.Add(Varr);
Slice := TransVar.SlicesTree(TransVar).CreateSlice(1);
NonLinear := Trans.FormulaItem(0).Method As IMsNonLinearRegressionTransform;
Oper := NonLinear.Operands;
Term := Oper.Add(Slice);
Info := Term.TermInfo;
Info.Assign(Oper.Item(0).TermInfo);
Term.TermInfo := Info;
NonLinear.Expression.AsString := NonLinear.Expression.AsString + "*" + Info.TermInnerText;
MObj.Save;
End Sub Main;
After executing the example, the Var_Factor1 variable is added to the model. Parameters of the term, that corresponds to a slice of the given variable, are set up according to parameters of the first term, that exists in the list. The new term is also added to the model equation.
See also: