17. System Commands for the Forms-based Tools : report Command--Run a Report : Passing Parameters on the Command Line : Passing an Entire Where Clause
 
Share this page                  
Passing an Entire Where Clause
In the following examples, the where clause itself is a variable for the report. You pass the entire where clause to Report‑Writer from the operating system command line in the variablename=value clause. The .query section in the report specification might look like this:
.QUERY select * from tablename where $wherevar
In this case, the value in the variablename=value syntax is a string containing the search qualifications. Enclose valuestring in single quotes to identify to Report‑Writer as a string, as shown in the following example:
report accounting recpay (wherevar='valuestring')
If the parenthetical clause contains characters special to your operating system, enclose the entire parameter within double quotes:
report accounting recpay "(wherevar='valuestring')"
The valuestring can include a variable and a value. If the value in the valuestring is a character string or date, it must be enclosed in quotes that are appropriate for your query language (single quotes for SQL). Dereference single quotes within the single‑quoted valuestring by doubling them ('').
For instance, in the following example enclose the date string, 12/31/98, in a double set of single quotes to dereference them inside the quotes surrounding the valuestring:
report accounting recpay
      (wherevar='date = ''12/31/98''')
If your operating system requires it, enclose the entire parameter within double quotes:
report accounting recpay
      "(wherevar='date = ''12/31/98''')"
The resulting valuestring is:
date = '12/31/98'
Note for QUEL Users
The entire where clause is passed to Report‑Writer from the operating system command line in the variablename=valuestring clause. The .query section in the report specification might look like this for QUEL:
.QUERY retrieve tablename.all where $wherevar
The valuestring can include a variable and a value. If the value in the valuestring is a character string or date, it must be enclosed in quotes that are appropriate for your query language (double quotes for QUEL). For instance, in the following example enclose the date string, "12/31/93" in double quotes within the single‑quoted valuestring:
report accounting recpay
         (wherevar='date = "12/31/98"')
If your operating system requires it, enclose the entire parameter within double quotes and escape any embedded double quotes.
Windows: To dereference double quotes in Windows, precede them with a backslash (\). For example:
report accounting recpay
"(wherevar='date = \"12/31/98\"')"
UNIX: To dereference double quotes in UNIX, precede them with a backslash (\). For example:
report accounting recpay
   "(wherevar='date = \"12/31/98\"')"
VMS: To dereference double quotes in VMS, double them. For example:
report accounting recpay
   "(wherevar='date = ""12/31/98""')"
The resulting valuestring is:
date = "12/31/98"