Share
 
 

Prompts

To allow the user to enter parameters used in queries the statements

PROMPT LINE

PROMPT TITLE

PROMPT DISPLAY

are used.

The fundamental way this works is as follows:

A number of PROMPT LINE statements define the list of values to be input or displayed and their formats. There will be one line displayed in a grid for each value.

The variables must be scalars. The variable can either have been defined and set before the PROMPT LINE statement or mentioned for the first time in the prompt line statement.

Valid values used in the prompt line statement are as follows, they will be explained in detail below:

PROMPT LINE <variablename>

PROMPT LINE <variablename> '<description>'

PROMPT LINE <variablename> '<description>' STRING

PROMPT LINE <variablename> '<description>' DATE

PROMPT LINE <variablename> '<description>' DP <numberofplaces>

All of these but the first may optionally be followed by

LIST <listvariablename>

FILE

FOLDER

MONTH

RANGE <startvalue> <endvalue>

In general PROMPT LINE is followed by the variable name and the description. If the description is omitted as in the first case, or if the description is the blank string '', the description will be the variable name.

If a variable has not been defined at the point of the PROMPT LINE clause

Examples of valid prompt lines

PROMPT LINE $x

This defines a number variable which will have the default of 2 decimal places in the grid and the description '$x'. This takes advantage of the special case where numeric variables can be defined by simply saying PROMPT LINE $x without having to give a description.

PROMPT LINE $s '' STRING

This defines a string variable. Note that because we want to use more than 3 parameters we have to add a description field for the variable, but we can take advantage of the special case where using the blank string '' will cause the variable name to be used as the description.

PROMPT TITLE '<title>' may be used to change the title of the row displayed from the default, which is 'SQL Prompt dialog'

If you wish the entire grid to be read-only so that the values can be looked at by the user but not altered, use the keyword READONLY following PROMPT DISPLAY i.e. say

PROMPT DISPLAY READONLY

This would typically be used to display the results of SELECT queries storing values in scalars and scalar expressions (see below).

Was this information helpful?