RecalcPrev;
The RecalcPrev method recalculates the previously calculated calculation algorithm object.
To get the previously calculated calculation algorithm object, use the IAlgorithmCalculationDebug.PrevObject property.
Executing the example requires that the repository contains a calculation algorithm with the ALGORITHM identifier. A calculation algorithm should contain at least three calculation objects.
Add links to the Algo, Metabase system assemblies. Add links to the assemblies required for working with calculation algorithms.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
Algo, Obj: ICalcObject;
ObjList, CloneList: ICalcObjectsList;
CalcAlgo: ICalcAlgorithm;
CalcDebug: IAlgorithmCalculationDebug;
i: Integer;
Begin
MB := MetabaseClass.Active;
// Get calculation algorithm
MObj := MB.ItemById("ALGORITHM");
Algo := CalcObjectFactory.CreateCalcObject(MObj, True);
CalcAlgo := Algo As ICalcAlgorithm;
// Get list of calculation algorithm objects
ObjList := CalcAlgo.Items;
// Copy list of calculation algorithm objects
CloneList := ObjList.Clone;
// Remove objects excluded calculation before debugging
For i := CloneList.Count - 1 To 0 Step - 1 Do
If Not CalcAlgo.Included(CloneList.Item(i)) Then
CloneList.Remove(CloneList.Item(i));
End If;
End For;
// Display the number of objects included in algorithm calculation and their names in the console
Debug.WriteLine("Number of objects: " + CloneList.Count.ToString);
For i := 0 To CloneList.Count - 1 Do
Obj := CloneList.Item(i);
Debug.WriteLine("- " + Obj.Name);
End For;
// Debug algorithm calculation
CalcDebug := CalcAlgo.Debug(CloneList);
i := 0;
While CloneList.Count > 0 Do
// Calculate next object
CalcDebug.NextStep;
// Recalculate the second object
If i = 1 Then
If CalcDebug.PrevObject <> Null Then
// Display name of recalculated object in the console
Debug.WriteLine("Recalculation: " + CalcDebug.PrevObject.Name);
CalcDebug.RecalcPrev;
End If;
End If;
i:=i+1;
End While;
// Finish debugging of algorithm calculation
CalcDebug.Stop;
End Sub UserProc;
After executing the example the calculation algorithm, in which the second object is to be recalculated, will be debugged. The console displays the number of calculated objects and their names, and also name of the recalculated object. for example:
Number of objects: 3
- Control block
- Calculation block
- Aggregation block
Recalculation: Calculation block
See also: