Using variables in reports

Report variables make customizing reports allow you to store an arbitrary value using a name you assign to the variable, and then use it throughout the report. For example, if you generate reports for different clients, you could assign the client name to a variable, and then instead of hardcoding the client name throughout the report, simply reference the variable by name.

Use the $set keyword to assign a value to a variable. Note that variables are identified by the “$$” prefix. You can use text, number, or pretty much anything else you can put on a line in Word. Here’s a simple example:

$set $$numbervalue 3.14159
$set $$wordvalue pi
$set $$textvalue is approximately
$$wordvalue $$textvalue $$numbervalue

If you created a report like the example above, it generates

pi is approximately 3.14159

A slightly more useful example: suppose that you are creating a use case specification report. You’ve added custom fields to use cases to track your effort and cost estimates. You want that information in your specification, but only if the report is being generated for in-house review. You could write two report templates, or you could declare a variable at the top of your report that indicates whether such proprietary information should be included. You can then add conditional logic throughout your report template that tests whether to include cost information or not:

$set $$includecosts no
$if $$includecosts = yes
…cost information appears here…

You can now control whether the cost information is generated in the report simply by changing the value of $$includecosts at the top of the report template.

Have more questions? Submit a request
Was this article helpful?
0 out of 0 found this helpful


Powered by Zendesk