Collapse AllExpand All

11.2. MetaSQL Statements

MetaSQL is a scripting language designed to handle dynamic database queries. MetaSQL tags such as <? if exists("parameter") ?> or <? value("parameter") ?> are embedded within standard SQL. Query results will vary depending on the existence and value of passed parameters. These MetaSQL statements are used by xTuple screens and reports to extract and format database information. When a MetaSQL statement is run, a parsing engine interprets the MetaSQL using the passed list of named parameters. The parsed result is standard SQL, which in turn is sent to the database. Naming and saving the MetaSQL Statements in the database allows multiple windows and reports to use the same MetaSQL Statement. For more information, please see the MetaSQL advanced topic in the OpenRPT User Guide.

Note

You must have been granted the ViewMetaSQL privilege to view statements, the MaintainMetaSQL privilege to create or edit statements, and the ExecuteMetaSQL privilege to run statements that change the database.

To access the master list of MetaSQL Statements, select the "MetaSQL Statements" option. The following screen will appear:

MetaSQL Statements List

The "MetaSQL Statements" screen displays information on all existing MetaSQL Statements, including Group, Name and Notes. If the MetaSQL is part of a larger package, the name of the parent package will be displayed—with all the child MetaSQL statements appearing in a nested list below it. Select the "Organize By Package" option to see an indented view of the MetaSQL statements and the package they belong to.