GetCalculatedPointsCount(MetaModelKey: Integer): Integer;
MetaModelKey. Key of the metamodel, which formulas caused changes in data cells.
The GetCalculatedPointsCount method returns the number of data consumer cells changed after executing formulas from the specified metamodel.
The property is used for easier check of modeling problem calculation results.
Executing the example requires that the repository contains a modeling container with the CONTAINER identifier. The modeling container must contain a modeling problem with the CONTAINER_TASK identifier and a metamodel with the CONTAINER_MODEL identifier.
Add links to the Metabase, Ms system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
MbDes1, MbDes2: IMetabaseObjectDescriptor;
Problem: IMsProblem;
Calc: IMsProblemCalculation;
CalcSet: IMsProblemCalculationSettings;
PointsCount: Integer;
MetaModel: IMsMetaModel;
Key: Integer;
Begin
// Get repository
Mb := MetabaseClass.Active;
// Get modeling problem
MbDes1 := Mb.ItemByIdNamespace("CONTAINER_TASK", Mb.GetObjectKeyById("CONTAINER"));
Problem := MbDes1.Edit As IMsProblem;
// Set up task calculation parameters
CalcSet := Problem.CreateCalculationSettings;
// Create an object for task calculation
Calc := Problem.Calculate(CalcSet);
// Start task calculation
Calc.Run;
// Get metamodel
MbDes2 := MB.ItemByIdNamespace("CONTAINER_MODEL", Mb.GetObjectKeyById("CONTAINER"));
MetaModel := MbDes2.Edit As IMsMetaModel;
// Get metamodel key
Key := MetaModel.Key;
// Get information about the number of data cells changed on metamodel calculation
PointsCount := Calc.GetCalculatedPointsCount(Key);
// Display information about the number of changed data cells in the console
Debug.WriteLine("Number of changed data cells: " + PointsCount.ToString);
End Sub UserProc;
After executing the example modeling task will be calculated. The console displays information about the number of data cells changed after executing formulas from the CONTAINER_MODEL metamodel.
See also: