Adding simple prompts

You can add simple prompts to a visual query, dynamart, analytical query, or compound dynamart to determine the data that is retrieved in this query so that only the specified value or ranges are used.

About this task

Use the Simple Prompt window to specify a prompt and add it to a query.

To add a simple prompt to a query:

Procedure

  1. In the query editor, switch to the Design tab.
  2. Use the Prompts pane on the Design tab to manage prompts.
    Note: In visual queries or dynamarts, the table in the Prompt Assignments pane lists the columns of the query and prompts assigned to these columns. In analytical queries, the Prompts pane lists the shared prompts that can be used for this query. For more information about shared prompts, see Working with shared prompts.
  3. To create a simple prompt, click New Prompt on the Prompts pane toolbar.
  4. Specify the name of the prompt in the Prompt name field of the Simple Prompt window.
  5. In the Display string field, type the prompt text that is displayed when you run the query.
  6. From the Input type list:
    • Select Literal for values that are enclosed within the double quotation marks if it is required by the database.
    • Select Date for values with a date part but no time part
    • Select Time for values with a time part but no date part.
    • Select Timestamp for values that contain both date and time parts.
    • Select As is for values that are passed to the database as they are entered, without any modification.
    • Select Enumeration for values that are represented as a set of predefined constants. See the example of use at the end of the topic.
  7. If you selected Time, Timestamp, or Date option:
    • You can specify the format string in the Format field. You can either choose one of standard formats or specify your own string that corresponds to Date and Time Patterns.
    • You can set the value in the Date and Time window. To open the window, click Choose default date or time.
  8. If you need a certain value to be used automatically when you run the query, select the Has default value check box and specify that value in the Default value field.
    Note: If the Has default value check box is cleared, you are prompted to input the value when you run the query. If it is selected, the specified default value is used automatically and the prompt window is not displayed.
  9. Assign the prompt to a query column by selecting one of available columns from the Assigned column list.
  10. To edit a simple prompt, select a prompt that you want to edit from the list of available prompts on the Prompts pane and then click Edit Prompt.
  11. To delete a simple prompt, select it from the list of available prompts in the Prompts pane and click Delete Prompt.
  12. Click OK to close the Simple Prompt window.

Results

To view the prompt values that you specified when you last ran the query, select Query > View Prompt Values.

Example

Use the Enumeration variable type in functions that require an array as a parameter, for example, in the in_op() function with getprompt() used in the argument. The values that are entered in getprompt() are parsed and represented as an array for the database. Consider a query that is based on the Sample Data Source from the Samples repository:
SELECT SHOP_NAME, ADDRESS, CITY, STATE, ZIP, PHONE FROM DEMO.PIZZA
You can create a free style filter with the formula: in_op(@[STATE], getprompt("state_arr")), and create the state_arr prompt of the enumeration type, then run the query and enter 'AK','AL' in the Prompt Variables dialog, the result set shows data only for AK, AL states.