Saturday, December 16

Using Variables

Google+ Pinterest LinkedIn Tumblr +

Think of a variable as a container that you can place values into and retrieve values from. The container stays the same, but what is in it can change. Vari­ables lend flexibility to formulas and can often shorten lengthy if-then-else formulas. In this section I will introduce variables and work through a few examples. To use a variable, you follow three basic steps:

1. Declare the variable, including the variable scope and name

2. Assign a value to the variable

3. Use the variable in a formula


Variable Scope

When using variables you must identify the variable scope, which describes where the variable is available. If you do not specify a variable scope, SCR assumes Global.

This variable type can be used and referenced in any formula in one report. Declare a global variable and any number of other formulas in the same report can use that variable.

•   Shared. This variable type can be used to share variables between a main report and a sub-report, and can be used any number of times by different sub-reports of the main report.

•   Local. This variable type can only be referenced and used in the for­mula in which it is declared.

Variable names cannot exceed 254 characters and cannot have the same name 3 as any SCR function, operator, or keyword. Variable names are case sensitive, so if you name a variable Hello and refer to it in a formula as hello, you will receive an error for hello does not exist (Must be Hello with a capital H).


About Author

Leave A Reply