Script variables

Top  Previous  Next

Instead of report variables, script variables are in the TfrxReport.Script. You can define them using FastScript methods. Let's look at some differences between report and script variables:

 

 

Report variables

Script variables

Placement

in the report variables list,
TfrxReport.Variables

in the report script,
TfrxReport.Script.Variables

Variable name

may contain any symbol

may contain any symbol;

but if used inside the report script its
name must conform to Pascal
identificator requirements

Variable value

may be of any type;

variables of string type are calculated each time they are accessed, and are, in themselves, expressions

may be of any type;

no calculation is performed;

behavior is like a standard
language variable.

Accessibility

programmer can see the list of report variables in the “Data tree” pane

variable is not visible -
programmer must know it exists

 

Working with script variables is easy. Just assign a value to the variable like this:

 

Pascal:

 

frxReport1.Script.Variables['My Variable'] := 'test';

 

C++:

 

frxReport1->Script->Variables->Variables["My Variable"] = "test";

 

Here FastReport creates the variable if it does not exist, or assigns the value to an existing variable. There is no need to use extra quotes when assigning strings to variables.