Insert queries into report scripts

You can insert queries into individual sections of a report script. Queries allow you to specify the data elements that are evaluated when a report is run.

You can insert queries directly in sections or using a Query data table. You also have the option to nest queries by inserting subordinate queries into a query.

Procedure (quick video)

  1. Open a report script in the design view of Script Editor.

  2. Right-click an area of a section into which you want to insert a query.

  3. Click Insert > Query Query in the pop-up menu.

  4. Set the required queries for the selected section.

    You can set queries for both the repetition area and the static area of each section.

    1. If you want to set a query for the repetition area, enable the Has repetitions option.

    2. Under Available data, select a data element and click Next Add to repetition.

      You can insert only one query into the repetition area.

    3. Under Available data, select a data element and click Next Add to static area.

      In this way, you can insert multiple queries into the static area.

  5. Click Next.

  6. Select a query from the Query list.

  7. If required, set the Parameters for the query.

    Depending on the selected data element of a query, different filters are available to you here.

  8. If required, set the Sort order for the output.

    Depending on the selected data element of a query, different sorting criteria are available to you here.

  9. Click Finish.

The queries are inserted into the selected section or area. If you have set a query for the repetition area, it is displayed with the corresponding query data label.

You can copy queries which have already been inserted and insert them into another query or section, provided that the set data of both queries is compatible. To do this, select the query you want to copy in the Structure column and press Ctrl+C. Then click in the section or on the query where you want to insert the query and press Ctrl+V.

See also

How are queries defined in report scripts?