Setting Variables in a Task
In a task, you may need to have working variables that you can manipulate. For example, you may need to perform a calculation on a Request variable value. There are several ways to create these "local variables".
The Procedure.Set Procedure Vars element allows you to set variables and values that can be used for calculations, etc., within the scope of the task.
Variables are created using a child Procedure Parameters element, which defines name-value pairs, just like other parameters elements, as shown above. The values can be set using literals, tokens, or expressions prefaced with the "=" sign. The resulting procedure variables can be referenced anywhere in the task using this token:
@Procedure.<Procedure.Set Procedure Vars element ID>.<variable name>~
Session variables can be also used in the same way for this purpose:
In the example above, a Procedure.Set Session Vars element has been added. The new session variable it creates applies the DateAdd function to a date passed as a Request variable. Now, in the Procedure.SQL element, we can use the token @Session.newStart~ to update a database table with the new date.
Session variables set in tasks are, of course, globally available and can be accessed later in report definitions and other tasks.