Any variable that is defined in the list of the report variables (“Report>Variables...” menu item) can be referenced in a script. The variable’s name should be enclosed in angle brackets:
PascalScript:
if <my variable> = 10 then ...
C++ Script:
if (<my variable> == 10) { ... }
An alternative way is to use the “Get” function:
PascalScript:
if Get('my variable') = 10 then ...
C++ Script:
if (Get("my variable") == 10) { ... }
A variable’s value is changed only via the “Set” procedure:
PascalScript:
Set('my variable', 10);
C++ Script:
Set("my variable", 10);
It is worth noting that to assign a string value to the variable you must add quotes around the value:
PascalScript:
Set('my variable', '''' + 'String' + '''');
C++ Script:
Set("my variable", "\"String\"");
System variables, such as “Page#,” should be referenced in exactly the same way:
PascalScript:
if <Page#> = 1 then ...
C++ Script:
if (<Page#> == 1) { ... }
|