KBI 310643 New Feature: SQL Variables For Generic Tables
Version
Argent Reports 3.0A-1308-A and above
Date
Fri, 16 Aug 2013
Summary
Argent Reports allows customers to define SQL Variables
SQL Variables can be used in the Generic Table definitions to make it easier to make changes without having to modify the SQL code directly
Technical Background
To use a SQL Variable, specify the name of the variable and add a ‘$’ to the beginning and end of the variable name
By default, single apostrophes are automatically wrapped around the SQL variable value
E.g. SELECT * FROM MyTable WHERE NAME = $MyVariable$
There are different data types — “Text”, “Date”, “Time” and “Date/Time”
“Text” allows open text while the other options provide you with a date or time picker for ease of modification
There may be cases where the automatically wrapped apostrophes are NOT wanted — e.g. if the value is a SQL function, like GETDATE()
In this case, UNcheck the option ‘Wrap SQL Variable value with apostrophes’ when setting up the SQL Variable
After adding the SQL Variables into the SQL Statement, customers can ‘Preview SQL Statement With Variables’ to see if the variable substitution is working as intended
Resolution
Upgrade to Argent Reports 3.0A-1308-A and above