OCLOperators PSEval
No edit summary
No edit summary
Line 1: Line 1:
Makes it possible use oclPS in any OCL expression. Using this you can "reach into" the database from OCL and action-language (EAL)
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
Expression template:
  SomeClass.PSEval(<ps-expression>,maxfetch,offset,<dependon>)
  SomeClass.PSEval(<ps-expression>,maxfetch,offset,<dependon>)
'''Note!'''  - PSEval don't subscribe on sets from db. To make the operator auto-updating, provide an expression in "dependon" that when changed should also rerun the PSEval expression. This can for example be a timer.
'''Note!'''  - PSEval 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 PSEval expression. This can, for example, be a timer.


Example
Example:
  Uppdrag.PSEval(self.Uppdrag->select(u|u.Aktivt)->orderDescending(u|u.Startdatum),  1000, 0, self.Uppdrag)
  Uppdrag.PSEval(self.Uppdrag->select(u|u.Aktivt)->orderDescending(u|u.Startdatum),  1000, 0, self.Uppdrag)
For example this expression from a method having "userName" as a parameter
For example, this expression from a method has "userName" as a parameter:
  SysUser.PSEval(SysUser.allinstances->select(su|su.Username=userName),2,0,<nowiki>''</nowiki>)
  SysUser.PSEval(SysUser.allinstances->select(su|su.Username=userName),2,0,<nowiki>''</nowiki>)
Always remember that your SQL-server might also need indexes and other performance settings to be able to execute your expression efficient.
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]]
See also: [[OCLOperators Sqlpassthrough|Sqlpassthrough]], [[OCLOperators PSEvalValue|PSEvalValue]]
[[Category:OCLOperators]]
[[Category:OCLOperators]]

Revision as of 08:10, 3 March 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.PSEval(<ps-expression>,maxfetch,offset,<dependon>)

Note! - PSEval 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 PSEval expression. This can, for example, be a timer.

Example:

Uppdrag.PSEval(self.Uppdrag->select(u|u.Aktivt)->orderDescending(u|u.Startdatum),  1000, 0, self.Uppdrag)

For example, this expression from a method has "userName" as a parameter:

SysUser.PSEval(SysUser.allinstances->select(su|su.Username=userName),2,0,'')

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

See also: Sqlpassthrough, PSEvalValue

This page was edited 47 days ago on 02/10/2024. What links here