Script variables

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 symbols. May contain any symbols. But if you want to use that variable inside the report script, its name should conform to Pascal identificator specifications.
Variable value May be of any type. Variables of string type are calculated each time you access them, and are, in itself, an expressions. May be of any type. No calculation is performed, behavior is like standard language variable.
Accessibility Programmer can see the list of report variables in the "Data tree" window. The variable is not visible, programmer should know about it.

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

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

In this case FastReport will create a variable if it is not exists, or assign a value to it. There is no need to use extra quotes when assigning a string to that variable.