MetaSQL is a scripting language developed by xTuple for use by the report writer. The language is designed to handle dynamic database queries. MetaSQL statements are embedded within standard SQL—for example, within the query source of a report definition. When a report is run, a parsing engine interprets the MetaSQL using a list of named parameters. The parsed result is standard SQL, which in turn is sent to the target database. The following diagram illustrates this process:
Dynamic queries are queries which contain conditional statements. Query results will vary depending on how the conditions are satisfied. For example, a report may return one result if a user makes one selection—or a different result if the user makes a different selection. The report results are conditional upon choices made by the user. The MetaSQL scripting language enables you to allow for and incorporate this conditionality into your report definitions.