You are here:
TRI.NET User's Guide: Revise Query
On this page:
You can revise existing queries by:
- Using Build Query and changing the selections, or
- Using Drill Downs from the context menu, or
- Using the Ad Hoc query feature, or
- Using Undo and Redo.
Modify via Build Query
Variables may be added to the query by checking their boxes. Variables used in the previous query may be removed from the query by unchecking their boxes.
When modifications are complete, new results can be produced by clicking "Run Query."
The use of the drill-down feature automatically updates the Build Query selections.
Use Ad Hoc Box
The Ad Hoc box is an advanced feature that allows users to add conditions to the query by modifying the WHERE clause of the SQL query. Having a basic understanding of the SQL query language and the use of the WHERE clause is recommended, including how to use proper syntax (e.g., NAICS='325'), and the comparison operators (e.g., < >, <, ≤, >, ≥). It is also recommended that the Show SQL option (Query menu → Show SQL) be turned on before using the Ad Hoc feature. Displaying the SQL query allows users to see changes to the query as they type in the Ad Hoc box.
For a complete list of the Data Elements and their Data Types, refer to the Metadata page. Note that there are sometimes two Data Elements for essentially the same variable, where one data element corresponds to a name and the other corresponds to an abbreviation or code. For example, chemical and cas; industry and naics; state and spc. Consult the Data Type on the Metadata page for the proper format to use.
Some useful examples using Ad Hoc conditions:
|Ad Hoc statement||What it does|
|name like 'EXXON%'||shows Exxon facilities|
|pctmin > 25||shows facilities with percent minority > 25% in 1-mile population|
|pctpov > 20||shows facilities with percent below the poverty level > 20% in 1-mile population|
|airlby > 10000||shows facilities reporting total air releases > 10,000 pounds|
|name like 'EXXON%' AND e3=0||shows Exxon facilities reporting no water releases|
After editing a query, you can click the "Undo" button to reverse changes made to the query. This feature is useful for going back to the previous query to try a different Drill Down.
Changes can then be restored by clicking the "Redo" button .
The "Undo" and "Redo" buttons can be used to go back and forth through the history of queries run in a TRI.NET session. For example, if you have modified and run a query three times and would like to go back to the original query, you can do so by clicking the "Undo" button three times. If you would then like to return to the query you ran following the three modifications, you can click the "Redo" button three times.
To build a new query, you can click "Build Query" and then "Clear" to remove all existing selections. You may then start a new Build Query session.
NOTE: If the "My TRI Neighborhood" feature is ON (the magnifier button on the toolbar will have a blue background like this ), you will have to clear it. To clear it, click the magnifying glass button and select "Cancel."