Eval

CTL1 offers two functions that enable inline evaluation of a string as if it were CTL code. This way you can interpret text that is e.g stored somewhere in a database as code.

When using the functions, keep in mind only valid CTL code should be passed to them. So you have to use proper identificators and even terminate expressions with a semicolon. The evaluated expression has a limited scope and cannot see variables declared outside of it.

Example 61.2. Eval() Function Examples

Example 1:

int value = eval_exp("2+5"); // the result of the expression is stored to 'value'
            

Example 2:

int out; // the variable has to be declared as global

function transform() {
   
   eval("out = 3 + 5;");
   print_err(out);
   $0.Date := $0.DATE;
   return ALL
}