Skip to main content

Queries

Version: 9.0

Queries

Single Query​

Writing queries in Designer is simple. In the Query Editor window, define a Connection String and then type the Query. To write a single query, follow the instructions below:

  1. In the Property window’s drop down list of elements (see Figure 1), select the Report to be used.

Figure 1 – Properties drop down list

  1. In the "Data" section of the report's properties, click the "Query" field
  2. Click the more button . This will display the Query Editor window.
  3. Specify the Connection String and the Query to be used (see Figure 2).
  4. Click "OK"

Figure 2 – Query Editor Window for Queries

 Nested Query​

Any report can contain one or more sub reports. This results in nested query statements. In many cases, these nested queries depend on the results of a parent query. Illustrated below is how to reference the results of one query from within a nested query.

Consider a case where a report will display a list of every company in a particular table (Query1) and then for each company there will be a sub report displaying each order a particular company has made (Query2).

The main report would have a standard SQL query as follows (see above for details on setting up this single query):

SELECT *
FROM Customers

The sub report would have a query as follows (see Figure 3):

SELECT *
FROM Orders
WHERE CustomerID = '#CustomerID#'

Notice that columns from previous queries can be referenced by surrounding the column name with the pound sign (#).

Figure 3 – Query for Nested Report