Edit

Val (exprText [, bRunOnServer])

Result Type: The result of exprText

Definition: Takes a text string containing an expression. Returns the result of the expression. This provides a way of deferring the evaluation of expensive calculations, or ones with side effects, on either side of an If function.

Examples:  val(if(c, "calculate:nthPrime(n)", "0"))

will only calculate the nth Prime if c is true. Without the val() the (presumably expensive) calculation would happen regardless of the value of c, with the result being discarded if c was false. This is because if() is a function, so all parameters will be evaluated.

+v9

In MoneyWorks 9.1.8 and later, there is also an option to have the epxression evalauted on the servr when using MoneyWorks Datacentre. This is useful if the expression is a very database-intensive function such as Analyse() or SumSelection(). The expression will only be evaluated on the server if the network latency is high. Pass true for the second parameter to enable evaluaiton on the server. Nothe that you cannot call scipt handlers using this mode.

-v9