PrxReport(CalcAlgorithm: ICalcAlgorithm): IPrxReport;
CalcAlgorithm. Calculation algorithm that contains an object.
The PrxReport property creates a regular report with data obtained after object calculation from data consumer.
Executing the example requires that the repository contains a calculation algorithm with the ALGORITHM identifier and a regular report with the REGULAR_REPORT identifier. A calculation algorithm should contain at least three calculation objects.
Add links to the Algo, Metabase, Report system assemblies. Add links to the assemblies required for working with calculation algorithms.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
Algo: ICalcObject;
CalcAlgo: ICalcAlgorithm;
CalcResult: IAlgorithmCalculationResult;
CalcObj: IAlgorithmTimeResults;
Obj: IAlgorithmTimeResult;
i: Integer;
Sec: Double;
Report, ReportCalc: IPrxReport;
Begin
MB := MetabaseClass.Active;
// Get calculation algorithm
MObj := MB.ItemById("ALGORITHM");
Algo := CalcObjectFactory.CreateCalcObject(MObj, True);
CalcAlgo := Algo As ICalcAlgorithm;
// Set regular report to build results of third object calculation
Report := MB.ItemByID("REGULAR_REPORT").Edit As IPrxReport;
// Calculate algorithm
CalcResult := CalcAlgo.Calculate;
// Get objects calculation result
CalcObj := CalcResult.Calc;
// Display result of third object calculation in the console
Obj := CalcObj.Item(2);
Debug.WriteLine("Name: " + Obj.Name);
Debug.WriteLine("Key: " + Obj.Key.ToString);
Sec := Obj.ExecuteMilisecods/1000;
Debug.WriteLine("Object calculation time: " + Sec.ToString + " sec");
// Save result of third object calculation to regular report
ReportCalc := CalcAlgo.Items.Item(2).PrxReport(CalcAlgo);
Report.CopyFrom(ReportCalc);
(Report As IMetabaseObject).Save;
End Sub UserProc;
After executing the example, calculation algorithm objects are calculated. The result of third object calculation will be loaded to regular report. The console displays information about third object calculation result, for example:
Name: Calculation block
Key: 292615
Object calculation time: 0.483 sec
See also: