@Prompt

You can use the @Prompt function to create an interactive object. You use a @Prompt function in the Where clause for an object. It forces a user to enter a value for a restriction when that object is used in a query. When the user runs the query, a prompt box appears asking for a value to be entered. @Prompts are useful when you want to force a restriction in the inferred SQL but do not want to preset the value of the condition.

Syntax

The syntax of the function is as follows:

 

@Prompt('message','type',[lov],[MONO|MULTI],[FREE|CONSTRAINED])

 

The syntax is described in the following table:

Syntax Description
'message' Text of the prompt message. The text must be enclosed between single quotes, for example, 'Choose a Region', 'Pick a time period', or 'Choose a showroom'. The text appears in the prompt box when the query is run.
'type'

Data type returned by the function. It can be one of the following:

·            'A' for alphanumeric

·            'N' for number

·            D' for date

The specified data type must be enclosed in single quotes.

lov

List of values (optional). You can specify two types of list of values:

·            Hard coded list. Each value is separately enclosed in single quotes and separated by a comma. The whole list is enclosed in curly brackets. For example, {'Australia', 'France', 'Japan', 'United Kingdom', 'USA'}.

·            Pointer to a List of Values from an existing object. You invoke the target lov by double clicking on the object containing the lov that you want to use in the Classes and Objects panel. This gives the Class name and the Object name, separated by a backslash. It must be enclosed in single quotes. For example: 'Client\Country'.

MONO User can only select only one value from the list of values (optional).
MULTI User can select multiple values from the list of values (optional).
FREE User can enter a value of their choice, or select one from the list of values.
CONSTRAINED User must select a value from the list of values.

Note.pngFor each of the optional parameters, if you omit an argument, you must still enter the commas as separators.

Example: Using @Prompt to restrict countries

The object Country returns values for the countries of resorts. If you want to restrict the returned values to resorts for only one country, you would need a separate object for each resort country in the universe. However, using the @Prompt, you need only one object as follows:

 

Using_@Prompt_to_restrict_countries1

 

The user is prompted to enter the name of the country, and the returned values are the resorts from that particular country, as shown below:
When a query is run in Web Intelligence, the following prompt box appears:

 

Using_@Prompt_to_restrict_countries2