Variables with Functions

When you define variables in Report Commander, the value of a variable can contain calls to functions. This makes it possible to create variables as shortcuts for complex function calls so you don't have to create the function call each time you need to use it.

For example, you may find yourself frequently needing this function call to insert yesterday's date in a report parameter: @DateAdd(,-1,"day"). Instead of having to remember/type that in each time you need it, you could define a shared variable named "Yesterday" and set its value to @DateAdd(,-1,"day"). You can do the same thing for other dates you commonly need to use, such as StartOfWeek, EndOfWeek, etc (see the Function Examples topic for samples of common function calls like this).

Here we have defined these variables as shared variables so that they will be available to all projects on the computer (variables are defined on the Project Properties panel):

Now when you need to insert yesterday's date, instead of inserting the full function call you can just use the "${Yesterday}" variable:

Related Concepts

Variables and Functions Overview

Related Topics

Function Examples

Reference

Function Reference

Date/Time Formats