OCLOperators PSEvalTuples
No edit summary
No edit summary
Line 1: Line 1:
Makes it possible to use oclPS in any OCL expression. Using this, you can "reach into" the database from OCL and action-language (EAL).
Expression template:
SomeClass.PSEvalTuples(<ps-expression>,maxfetch,offset,<dependon>)
'''Note!''' - PSEvalTuples doesn't subscribe on sets from DB. To make the operator auto-updating, provide an expression in "dependon" that, when changed, should also rerun the PSEvalTuples expression. This can, for example, be a timer.
Example:
Consultant.PSEvalTuples(self.Assignments->select(a|a.Active)->collect(a|a,a.Consultant,a.BilledHours->select(bh|bh.WorkDate>vTheStartDate).Hours->sum),  -1, 0, vTheStartDate)
The above expression reach into the database for all Consultants, takes the active assignments, sums the BilledHours that has been reported after vTheStartDate and returns a list of tuples of type {Assignment,Consultant,Part1} where part1 will be the sum of hours.
Always remember that your SQL-server might also need indexes and other performance settings to execute your expression efficiently.


See also: [[OCLOperators Sqlpassthrough|Sqlpassthrough]], [[OCLOperators PSEvalValue|PSEvalValue]], [[OCLOperators PSEval|PSEval]]
See also: [[OCLOperators Sqlpassthrough|Sqlpassthrough]], [[OCLOperators PSEvalValue|PSEvalValue]], [[OCLOperators PSEval|PSEval]]

Revision as of 10:27, 5 June 2023

Makes it possible to use oclPS in any OCL expression. Using this, you can "reach into" the database from OCL and action-language (EAL).

Expression template:

SomeClass.PSEvalTuples(<ps-expression>,maxfetch,offset,<dependon>) 

Note! - PSEvalTuples doesn't subscribe on sets from DB. To make the operator auto-updating, provide an expression in "dependon" that, when changed, should also rerun the PSEvalTuples expression. This can, for example, be a timer.

Example:

Consultant.PSEvalTuples(self.Assignments->select(a|a.Active)->collect(a|a,a.Consultant,a.BilledHours->select(bh|bh.WorkDate>vTheStartDate).Hours->sum),  -1, 0, vTheStartDate) 

The above expression reach into the database for all Consultants, takes the active assignments, sums the BilledHours that has been reported after vTheStartDate and returns a list of tuples of type {Assignment,Consultant,Part1} where part1 will be the sum of hours.

Always remember that your SQL-server might also need indexes and other performance settings to execute your expression efficiently.

See also: SqlpassthroughPSEvalValuePSEval

This page was edited 49 days ago on 03/19/2024. What links here