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, go to System > Design > MetaSQL Statements. The following screen will appear:

MetaSQL Statements

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.