Report Commander 2.5 96
Variables and Functions
Variables and Functions
Variables and functions are related features that allow you to use dynamic content (content
that gets calculated when a report is executed) in parameters, file names, and other text in
your report processing settings. For example, using variables and functions you can:
l Make it easy to move projects between computers that use different paths for reports and
outputs.
l Automatically use the current date/time (or dates calculated based on the current
date/time) in report parameters, file names, etc.
Report Commander version 1 had a similar but much more limited capability called
dynamic file names and parameters. Dynamic text from the old version will be
converted to the new format automatically. See the Variable Syntax Changes from
Version 1 topic for more information.
UsingVariables and Functions
Variables and functions are supported throughout Report Commander in most place where you
need to enter parameters, file names, or other text. Wherever you see a text entry box in the
Project Editor that has a {}button next to it, this indicates that the field supports variables
and functions. When you click the button, the Text Edit window opens. This window provides a
list of available variables and functions, and includes tools to help you insert them into your
text using the correct syntax.
Variables
Variables allow you to insert predefined text into parameters, file names, and other text
boxes in Report Commander.
Suppose that on one computer where you use Report Commander, all the report files are
located in the folder "c:\reports". But you also want to be able to execute your projects on a
second computer, which reads the reports over the network using the UNC path
"\\mycomputer\reports". To avoid having to change the report path for your projects when
you move them from one computer to the other, you can define a variable named
"ReportPath" and set it to "c:\reports" on the first computer, and "\\mycomputer\reports" on
the second. Then, in all your projects, you use the "ReportPath"variable when specifying the
report name, instead of writing in the fixed path.
To do this, you open the Project Properties for one of your projects and go to the Variables
tab. Here you add a User Variable named "ReportPath" with the value c:\reports. (A "user"
variable means that it is available to all projects you work with on the computer, so you only
have to define this variable once.)
Then, in the Report Properties where you specify the report filename, instead of entering
c:\reports\report1.rpt, you enter ${ReportPath}\report1.rpt. When you execute the