IMsFormulaTermList.Cleanup

Syntax

Cleanup([CleanupVariables: Boolean = false]);

Parameters

CleanupVariables. It determines whether variables corresponding to unused terms are deleted.

Description

The Cleanup method deletes the terms that are not used in the model expression from the collection.

Comments

Available values of the CleanupVariables parameter:

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.

Example

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:

IMsFormulaTermList