Collapse AllExpand All

7.3.1. Submitting MetaSQL Statements to the xTuple Connect Batch Manager

When the xTuple Connect package is enabled, a SCHEDULE button appears on the MetaSQL Statements screen. This allows you to submit any of the shared MetaSQL statements to the xTuple Connect Batch Manager. Follow these steps to do so:

  1. Follow this path: System > Design > MetaSQL Statements

  2. Select a MetaSQL statement from the list

  3. Click the SCHEDULE button

  4. The screen should look similar to this:

    Submitting a MetaSQL Statement to the Batch Manager

  5. Set the type and value of each of the parameters in the list in turn (see Section 7.3.1.1, “Active vs. Inactive MetaSQL Parameters”):

    1. Select a parameter from the list at the top of the Review EDI Before Sending screen

    2. Click the EDIT button

    3. The screen should now look like this:

      Sample Parameter Editor

    4. Choose an appropriate data type from the "Type" list. This will help ensure that the value you enter is valid

    5. Click the "Active" box if you want to send it to the MetaSQL statement

      Note

      You usually want the parameter to be active. See Section 7.3.1.1, “Active vs. Inactive MetaSQL Parameters” for details.

    6. Enter the desired value for the parameter

  6. Click the ACCEPT button

7.3.1.1. Active vs. Inactive MetaSQL Parameters

Many MetaSQL statements are written to behave in special ways if specific parameters are active or not. For example, many screens let you choose to see Items with all Class Codes, just some Class Codes, or a particular Class Code. These work by having queries that check whether certain MetaSQL parameters are active or not:

SELECT ...
FROM item, ...
WHERE ...
<? if exists("classcode_id") ?>
  AND  (item_classcode_id=<? value("classcode_id") ?>)
<? elseif exists("classcode_pattern") ?>
  AND  (item_classcode_id IN (SELECT classcode_id
                             FROM classcode
                             WHERE (classcode_code ~ <? value("classcode_pattern") ?>)))
<? endif ?>
...

In this example, when the user selects a particular Class Code, the screen makes the classcode_id parameter active. The query then looks only at items with the selected Class Code. If the user enters a Pattern, then the screen makes the classcode_pattern parameter active and all Items with Class Codes matching that pattern are displayed. If neither classcode_id nor classcode_pattern is active, there is no comparison with any Class Code and so all Class Codes are displayed.

If you are not going to make a MetaSQL Parameter active, you do not need to set the type or value for it before submitting the MetaSQL Statement to the xTuple Connect Batch Manager.

7.3.1.2. The xTupleMetaSQLEmail EDI Profile

The EDI Profile used by the SCHEDULE button on the MetaSQL Statements screen is fixed—it always uses the Profile xTupleMetaSQLEmail. This profile has the following properties by default:

  • It always sends email

  • The email gets sent to the email address of the user who clicked the SCHEDULE button

  • The user is given a chance to review the EDI before it is submitted, which is required so the user can set values for the MetaSQL Parameters

  • The output is in CSV format

Submitting MetaSQL statements to the xTuple Connect Batch Manager always uses the xTupleMetaSQLEmail profile. You can edit this profile, but be aware that it may change in future releases and your edits will be lost. By default this profile sends email to the xTuple ERP user who submits the job.