To create a new MetaSQL statement, select the
button. The following screen will appear:The MetaSQL Editor can be used to create new MetaSQL statements or edit those already found on the MetaSQL Statements master list. Once created, new MetaSQL statements can be added to the master list, making them available for use in the application. To edit an existing MetaSQL statement, simply load the statement into the editor from the database you are currently connected to. Then edit the statement and save it back to the database once editing is complete.
The body of a MetaSQL statement is an SQL SELECT
, UPDATE
or DELETE
statement. (The user must have been granted the ExecuteMetaSQL
privilege to run the UPDATE
or DELETE
statement.) Passed parameters can be utilized to control how the statement operates (using an IF
, ELSE
, ENDIF
construct) and their values can be inserted. The core xTuple PostBooks Edition contains many statements that can be used as examples.
The MetaSQL Editor toolbar has icon shortcuts for new, open, save, undo, cut, copy, and paste. The MetaSQL Editor menu has many options to simplify the development of MetaSQL statements, including viewing and editing the parameter list, executing the query, and viewing the query results.
When saving a new MetaSQL statement, you are presented with the following options:
Saves the MetaSQL statement into the database you are currently connected to, with the option of also saving the statement to a file.
Saves the MetaSQL statement to a file.
Allows you to save the MetaSQL statement with a different name to either the database your are currently connected to or to a file.
If you are saving the MetaSQL statement to the database using alternate information (i.e.,
), the following screen will appear:When saving a MetaSQL statement to the database using alternate information, you are presented with the following options:
You would normally select the public schema. However, there are situations where you may want to define the MetaSQL statement in a different schema.
Enter the group for the MetaSQL statement. This is the major grouping for statements and normally reflects the type or source of information. Some examples are arHistory
, purchaseOrders
, etc.
Enter the name for the MetaSQL statement. This is detailed name for the statement within the group.
Enter the grade number for the MetaSQL statement. If there are multiple MetaSQL statements with the same group/name, the one with the highest grade number will be used. It is a good idea to save changes to statements with a higher grade number so, if necessary, you can refer to the original statement before implementing the changes. Use the menu option
to change the grade of a statement.Enter any notes or comments related to the MetaSQL statement.