CalcIt Commands

EXECCODE(TheCode, &Result, List of variables of the calling code)

This command accepts as data a piece of CalcIt code in its TheCode parameter, compiles it, executes it and returns the result in the IN/OUT parameter Result. Can be especially useful in case of Form variables and the Forms they handle to make the user able to enter expressions in edit controls. With this command can be simulated the functionality the Calculation Forms have where the user can enter expressions instead of single constant values.

Returns TRUE if the operation was successful. Returns FALSE if was a problem either in the compilation or in the execution of the code. In case of an error then the Result parameter takes a description of what caused the error.

NOTE: The code passed in this command can be anything a valid CalcIt code is.

In case is needed an extensive communication between the calling code and the code executed by ExecCode then the optional list of variables can be used. There all variables of the calling code which have to be visible by ExecCode executed code, can be passed. The variables are passed by reference (can be read or modified). The accepted type of variables are the following:

  1. Simple
  2. Class variables
  3. File
  4. Buffer
  5. Array
  6. Automation Object
  7. Form

An example:

a:=100;
set b(100);

if(ExecCode('b(50):=678;a++',r,a,b));
 print(a);
 print(b(50));
end;

See also Using Form variables

Go Back