How to Create a New Query

A query enables you to pull information from your database based on criteria you specify. This topic steps you through the processes of creating, running, modifying, and saving a new query.


Creating a New Query

Running a Query

Modifying a Query

Saving a Query

Creating a New Query

If you are a beginner, you may find it helpful to review some suggestions that can help you save time and avoid some design problems. For details, go to Suggestions for Designing Queries.

  1. Click .

  2. Choose the columns that contain the information you want to include in the query. To do this, complete these steps:

  1. In the Column Picker panel, find the group that contains the columns you need. Then, click to expand the group to view the columns.

Some groups contain subgroups. Click to expand the subgroup to view the columns within it.

  1. Scroll down the list and select the checkboxes next to the columns you need. For example:

At this point, the order in which you select the columns does not matter. You can change the order in which the columns appear in your results later.

  1. Add the columns to the Result Columns panel by doing one of the following:
  1. If you need to add more columns to the query, either use the drag-and-drop method or the add column link method. Continue adding columns until all of the columns you need in the query are showing in the Result Columns panel.
  1. Be aware that the order in which the columns are listed in the Result Columns panel is the same order in which they appear in your results. If you want to change the order in which the columns appear in your results, complete the following:

You can also drag use the drop-and-drop method to re-order columns. To learn how to use this alternative method, go to  Using_Drag-and-Drop_to_Reorder_Columns.

  1. Place your cursor on top of the name of the column you want to move. Slide the cursor to the left until you see this icon: . Click it to display this menu:

 

  1. The column order options are at the bottom of the menu. Select the desired option to move the column into the desired position:
  1. If you want to summarize a column's data, you need to apply an aggregate function to it. To do this:

For information about aggregate functions, go to How to Calculate a Column's Data (Aggregate Functions).

  1. In the Results Column, place your cursor on top of the name of the column whose data you want to summarize.
  2. Slide your cursor to the right until you see this icon: . Click it to display the aggregate functions menu:

  1. Select the function you want to apply to the column's data.

For example, if you want to count the data in the column, select Count. The name of the function is added to column name to indicate it will be applied to the column's data, as shown below:

To remove the function from the column, click again.

  1. By default, the information in a column is not sorted. If you want to a column's information to display in a specific order, you need to specify a sorting order. Do the following for each column whose data you want to sort:
  1. Place your cursor on top of the name of the column. Slide the cursor to the left until you see this icon: . Click it to display this menu:

  1. The sort order options are in the group at the top of the menu. Select one of these sort options:
  1. By default, no conditions are applied to columns in the query. Conditions are criteria your can apply to a column to limit the results. For each column you need to apply a condition to, do the following:

If necessary, take a look at some examples of query conditions to help you think about your own query criteria.

  1. Click the [Add new condition] link in the Query Conditions panel.
  2. Select the column that you want to apply the condition to.

A condition statement that applies to that column's data is displayed. For example, selecting the Families > Family DUID column displays this condition statement:

  1. Specify the condition by selecting an operator and a value. For operator descriptions and examples, see Query_Operators_and_Examples.
  1. Now that you have chosen the columns you want to include in your query, specified the arrangement of the information, and applied conditions, you are ready to run your query. Go to Running_a_Query, which follows.

Running a Query

After you build a query, run it to retrieve results from your database. To run a query:

  1. If you want to make sure that the query results show unique records only (no duplicates), select the Unique Records Only checkbox at the top of the Query Results panel.

  2. To run the query, click .

The results of your query are displayed in the Query Results panel. The top right portion of the panel shows the number of records found that match your query criteria.

  1. To display results in full-screen view, click . (This button is located at the top of the Query Results panel.)

This button is toggle. If you click it again, the results are re-displayed inside of the Query Results panel.

Modifying a Query

If the results are acceptable, you can skip this step and go to Saving_a_Query.

If you need to make changes to the query, consult these topics for information on how to make specific changes:

        How to Add, Remove, or Replace a Column

        How to Reorder the Columns in Your Query Results

        How to Rename a Column Heading in Your Query Results

        How to Sort a Column's Data

        How to Add, Edit, or Remove a Condition

Re-run the query to view the results of your changes.

Saving a Query

After you run the query, you can save it for future use. You keep the query private (for your eyes only) or you can share it with other users.

  1. To save your query, click .

The Save Query window opens:

  1. Complete the following:
  1. (Required) In the Name field, type a name for the query.
  2. To share the query with other users in your organization, select the Global checkbox. If you want the query to remain private, leave the box unchecked.
  3. To assign a  tag to the query, select one from the Tags dropdown list.

The Tags list contains only the tags saved in your system. If you need to apply a tag not found in the list, you must create it first. For instructions, go to Creating_a_Tag. You can then edit the details of the query to apply the tag you created.

  1. In the Description field, type a description of the query.

It is a good idea to add a description that indicates the purpose of the query.

  1. Click .

The system saves the query and adds it to the My Queries and Recent Queries lists. You see this message next to the name of the query in the title bar: Query Saved.

 

 

 

Related Topics

 

 

<Back to top>