Articles report variables are temporary storage containers that exist inside the report engine during report generation. They allow you to store values, pass information between script and expressions, and control conditional logic in headers, footers, and data bands.
Variables are defined in the Report → Variables window and can be read or written from:
- Expressions inside memo text
- PascalScript event handlers
- The application code (Delphi) before running the report
What Variables Are Used For
Articles variables are useful when you need to:
- Track state across pages (e.g., “Is this page a continuation?”)
- Store intermediate results
- Control conditional visibility or formatting
- Pass values from Delphi into the report
- Build dynamic text using expressions
- Accumulate totals or flags during script execution
They behave like simple named values that the report engine evaluates at runtime.
Variable Types
Although Article variables appear “typed,” internally they are stored as strings. The expression engine automatically converts them to:
- Numbers
- Booleans
- Dates
- Text
depending on how they are used.
Examples:
| Value | Interpreted As |
|---|---|
"1" | True / numeric 1 |
"0" | False / numeric 0 |
"2026-05-10" | Date |
"Vendor Payments" | String |
This makes variables flexible but also means you must compare them as strings in expressions.
Using Variables in Expressions
Inside memo text, variables are referenced using angle brackets:
Code
<VariableName>
Example:
Code
Page: <Page> of <TotalPages>
For conditions:
Code
[IIF(<IsContinued> = '1', '(Continued)', '')]
Setting Variables in Script
Articles PascalScript cannot assign directly to <VariableName>. Instead, you must write to the variable through the Report.Variables[] collection:
pascal
Report.Variables['IsContinued'] := '1';
Example in a band event:
pascal
procedure MasterData1OnAfterPrint(Sender: TfrxComponent);
begin
if Engine.FreeSpace < MasterData1.Height then
Report.Variables['IsContinued'] := '1'
else
Report.Variables['IsContinued'] := '0';
end;
Is is also important to define a Report Variables when the report starts. So in the start block set the defaults. The start block is the begin end at the bottom of the script.
begin
Report.Variables['IsContinued'] := '0';
end.
We use IsContinued here to show (Continued) in a memoview component when the detail does not fit one page. It tell the report use that the data on the new page is a continuation from the prior page.
Why Variables Matter
Variables are the bridge between:
- Script logic
- Expression logic
- Application logic
They allow you to build reports that are:
- Dynamic
- Conditional
- Stateful
- Data‑aware beyond the dataset
Without variables, Articles would be limited to static text and dataset fields.