Cleanup([CleanupVariables: Boolean = false]);
CleanupVariables. It determines whether variables corresponding to unused terms are deleted.
The Cleanup method deletes the terms that are not used in the model expression from the collection.
Available values of the CleanupVariables parameter:
True. Variables corresponding to unused terms are deleted from model parameters.
False. Variables corresponding to unused terms are kept.
The parameter in Fore is optional and is set to False by default.
To delete all terms from the collection, use the IMsFormulaTermList.Clear method.
Executing the example requires that the repository contains a modeling container with the MS identifier that contains a determinate equation model with the DETERM identifier.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
ModelCont: IMetabaseObjectDescriptor;
Model: IMsModel;
Transform: IMsFormulaTransform;
Formula: IMsFormula;
Determ: IMsDeterministicTransform;
Operands: IMsFormulaTermList;
Begin
// Get current repository
mb := MetabaseClass.Active;
// Get model
ModelCont := mb.ItemById("MS");
Model := mb.ItemByIdNamespace("DETERM", ModelCont.Key).Edit As IMsModel;
// Get model parameters
Transform := Model.Transform;
// Get model factors
Formula := Transform.FormulaItem(0);
Determ := Formula.Method As IMsDeterministicTransform;
Operands := Determ.Operands;
// Delete all factors unused in the model expression
Operands.Cleanup(True);
// Save changes
(Model As IMetabaseObject).Save;
End Sub UserProc;
After executing the example, all factors that are not used in the model expression will be deleted from the model.
See also: