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:
- In the query editor, switch to the Design tab.
- 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.
- To create a simple prompt, click New Prompt on the Prompts pane toolbar.
- Specify the name of the prompt in the Prompt name field of the Simple Prompt window.
- In the Display string field, type the prompt text that is displayed when you run the query.
- 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.
- 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.
- 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.
- Assign the prompt to a query column by selecting one of available columns from the Assigned column list.
- 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.
- To delete a simple prompt, select it from the list of available prompts in the Prompts pane and click Delete Prompt.
- Click OK to close the Simple Prompt window.
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:
You can create a free style filter with the formula:
SELECT SHOP_NAME, ADDRESS, CITY, STATE, ZIP, PHONE FROM DEMO.PIZZA
in_op(@[STATE], getprompt("state_arr")), and create the
state_arrprompt 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.