Query Expressions, Clauses, and Prompts
About Query Expressions, Clauses, and Prompts
Create an Expression
Before You Begin
About This Task
Procedure
- To create a simple expression:
- To create an advanced expression:
Create a WHERE Clause
Procedure
- Access the Design workspace for the query within which you want to create a WHERE clause.
- For an aggregate query, select Where in the Total cell.
- Access the Expression Builder window from the Criteria or Or cells, enter the necessary parameters, and then select Done.
- For an aggregate query, clear the Include and Display check boxes in the column in which you want to create a WHERE clause.
Results
- The WHERE clause is generated in the SQL code.
- If you want to modify the clause, you can do so in the Expression Builder window, or you can modify the SQL code directly.
Create a HAVING Clause
Procedure
- Access the Design workspace for the query within which you want to create a HAVING clause.
- In the Conditions section, make sure the Show Totals check box is selected.
- In the Total cell of the desired field, in the drop-down list, select any option other than Where.
- Access the Expression Builder window from the Criteria or Or cells, enter the necessary parameters, and then select Done.
Results
- The HAVING clause is generated in the SQL code.
- If you want to modify the clause, you can do so in the Expression Builder window, or you can modify the SQL code directly.
Delete an Expression
Procedure
Access the Prompt Settings Section
Procedure
Create a Prompt with No List of Valid Values
Procedure
Results
- When a user runs the query, the prompt will appear. If you specified a default prompt value, that value will appear in a modifiable text box.
- If the user enters a value that does not exist in the limiting field, the query will not return any results. For example, if two asset types exist in the results, such as Rotating Pumps and Centrifugal Pumps, and the user enters Reciprocating Pump, the query results will be empty.
Create a Prompt with a Static List of Valid Values
Procedure
Results
- When a user runs the query, the prompt will display the list of predefined values. The user will need to select a value to view the query results.
Create a Prompt with a List of System Codes
Procedure
Results
- When a user runs the query, the prompt will contain a list of values as defined in the associated System Code Table.
Create a Prompt with a List of Query Results
Before You Begin
- If the selected query contains only one column, the values return in that column will be displayed in the list of available prompt values. For example, if the query contains the Equipment ID column, the prompt will display a list of Equipment IDs.
- If the selected query contains more than one column, the list of prompt values will contain a concatenated list of values from the second column and each subsequent column. For example, if the query results look like this table:
Equipment ID Manufacturer Description Status 123 Alco Tank Active 456 Whitlock Pump Inactive 789 Delta Pressure Vessel Active ... the list of prompt values will look like this:
- Alco Tank Active
- Whitlock Pump Inactive
- Delta Pressure Vessel Active
About This Task
Tip: You can use a prompt with a list of query results to filter a dependent prompt's values.
Procedure
Create a Prompt with a List of Values from a Record
About This Task
Tip: You can use a prompt with a list of values from a record to filter a dependent prompt's values.
Note: For a family with a large number of records, it will take a long time to populate this list.
Procedure
Results
- When the user runs the query, the prompt will display a list of values pulled from the selected field for all records in the selected family.
Create a Prompt on a Logical Field
Procedure
Results
Filter Prompt Values Based on Previous Prompt Selections
Before You Begin
- These instructions assume that you have already created a Select query for a family that contains at least two fields, and that you have added those fields to your query.
- The first prompt should exist in a column that appears to the left of the column on which you will build the second prompt. If you do not order the fields this way, the values in the first prompt will still filter the values in the second prompt, but the second prompt will appear first when you run the query, which does not follow the appropriate workflow.
About This Task
Procedure
Results
When you run the query, the first prompt will display a list of values according to how you specified the valid values (e.g., static list of valid values). The second prompt will display only values that apply to the first prompt's value.
Modify an Existing Prompt
Before You Begin
- You cannot modify a prompt using the Prompt Settings section. The Prompt Settings interface does not store settings for existing prompts.
- If you want to use the Prompt Settings section to modify a prompt, you can recreate the prompt and include your modifications in the Prompt Settings section.
Procedure
- Access the SQL workspace, or Access the Expression Builder window.
- Modify the prompt as needed.