Collapse AllExpand All

1.1. Query Sources Overview

The report writer uses structured query language (SQL) to retrieve information from a database. In this section, we will look at how report definitions use SQL queries to collect the information which is displayed in a report.

To view the SQL query associated with the UsersMasterList report definition, select the Query Sources option from the Document menu. The following screen will appear:

Query List

The Query master list shows all the queries defined for a report definition. In this case, only one query has been defined. To view the query, double-click on it—or highlight it and then select EDIT. The following screen will appear:

Query Editor showing SQL statement

The basic SQL query structure used by many report definitions reads as follows:

SELECT (column) FROM (table) WHERE (condition) and, optionally, ORDER BY (column).

The query shown above follows this basic format.

Readers familiar with SQL may have noticed portions of the statement surrounded by <?...?> tags. These tags signal the use of MetaSQL. MetaSQL is an embedded query language designed to make SQL queries dynamic. The MetaSQL language was developed by xTuple for use by the report writer.

Note

For more information on MetaSQL, the embedded query language designed by xTuple to make SQL queries dynamic, please see the Advanced Topics chapter.

We could edit the query using the query editor. But at this point, we simply want to familiarize ourselves with the query. We will be making cosmetic changes to the report in the next sections.