UpdateSlice(Value: IMsFormulaTransformSlice; Lag: String);
Value. The variable slice that is necessary to be updated.
Lag. Lag that is necessary to assign.
The UpdateSlice method is used to refresh variable slice and lag referenced by the given term.
NOTE. The method is outdated, use the TermInfo property instead.
Executing the example requires a model with the NEW_NONLINREG identifier in the modeling container. Use the method of non-linear regression for model calculation.
Sub Main;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Model: IMsModel;
Trans: IMsFormulaTransform;
VarTrans: IMsFormulaTransformVariable;
Tree: IMsFormulaTransformSlicesTree;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
NonLinear: IMsNonLinearRegressionTransform;
TransVar: IMsFormulaTransformVariable;
TermX1: IMsFormulaTerm;
s: String;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemByIdNamespace("NEW_NONLINREG", MB.ItemById("KONT_MODEL").Key).Edit;
Model := MObj As IMsModel;
Trans := Model.Transform;
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.NonLinearRegression;
NonLinear := Formula.Method As IMsNonLinearRegressionTransform;
TransVar := Model.Transform.Inputs.Item(0);
TermX1 := NonLinear.Operands.Item(0);
//receiving of the new variable slice
Slice := TransVar.SlicesTree(VarTrans).CreateSlice(3);
//updating of slice and log in a term
TermX1.UpdateSlice(Slice, "-3");
MObj.Save;
End Sub Main;
After executing the example the term referring to a slice of the first input variable of model is updated.
See also: