OCLOperators scripteval
(Created page with "ScriptEval is an operator on a model object (the context) that lets you have expressions as data and evaluate those expressions. You must state the valid Return type. let in...")
 
(Updated Edited template to July 12, 2025.)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
ScriptEval is an operator on a model object (the context) that lets you have expressions as data and evaluate those expressions.
<message>Write the content here to display this box</message>
ScriptEval is an operator on a model object (the context) that lets you have expressions as data and evaluate them.


You must state the valid Return type.
You must state the valid Return type.
  let info=self.ScriptEvalCheck(false,Double, self.SomeString) in
  let info=self.ScriptEvalCheck(false,Double, self.SomeString) in
  (
  (
   (info='ok').casetruefalse(self.ScriptEval(false,Double, self.SomeString).asstring,info)
   vSomeStringResult:=(info='ok').casetruefalse(self.ScriptEval(false,Double, self.SomeString).asstring,info)
  )
  )
The above code will check if the self.SomeString value is a valid expression in the context of self and whether it returns a double - if so, the result will be converted to string and assigned to vSomeStringResult. If it's not a valid expression, the problem with the expression will be in vSomeStringResult.
Using the default model:
0.2222+self.SomeInt+self.SomeDateTime.Ticks
[[Category:OCLOperators]]
{{Edited|July|12|2025}}

Latest revision as of 05:58, 20 January 2025

This page was created by Hans.karlsen@mdriven.net on 2022-03-30. Last edited by Edgar on 2025-01-20.

ScriptEval is an operator on a model object (the context) that lets you have expressions as data and evaluate them.

You must state the valid Return type.

let info=self.ScriptEvalCheck(false,Double, self.SomeString) in
(
  vSomeStringResult:=(info='ok').casetruefalse(self.ScriptEval(false,Double, self.SomeString).asstring,info)
)

The above code will check if the self.SomeString value is a valid expression in the context of self and whether it returns a double - if so, the result will be converted to string and assigned to vSomeStringResult. If it's not a valid expression, the problem with the expression will be in vSomeStringResult.

Using the default model:

0.2222+self.SomeInt+self.SomeDateTime.Ticks