Use the Trigger Wizard

System Location: Global

This example shows how to create a basic SQL Statement with fields from two tables by using the Trigger Wizard.

  • It is beyond the scope of this example to provide details related to "manual" SQL Statement creation, editing, and syntax. For assistance in creating specific SQL Statements, contact support to determine potential costs.

For more information see Add a Trigger.

Select The System Area For The Trigger

Purchase Orders will be used for purposes of this example, however Triggers can be created for any of the areas located under Data Entry in addition to any Table or Base Table (located under System.)

  1. Select the area where the Trigger will be created. In this example, that will be Purchase Orders.
  2. Select the specific record (P.O.) the Trigger is being created for (in the appropriate Navigator Grid.)
    • If the Trigger is going to be a global one, it does not really matter which record is selected.
  3. Click the Triggers button (located in the Quick Access Toolbar.)Triggers Button
    • The Triggers screen opens, displaying Triggers already associated with the selected area.
  4. Click 'New.'
    • The Trigger Wizard can be used on an existing Trigger; however since it completely overwrites any values present in the 'SQL Query' field, it is assumed that it will be used primarily when creating a new Trigger.

Provide Values For The Wizard

Select Tables And Fields

This example will create a Trigger (SQL statement) that monitors when Purchase Orders are created for a specific part; however the logic remains the same regardless the Tables and Fields selected.

  1. Click 'Build' (located under the 'SQL Query' field.)

    Build Button

    • The Trigger Wizard opens to the 'Field Selection' screen.
  1. Open the 'Available Tables' dropdown menu.
    • This menu displays the various tables that are associated with the selected system area / record that can be used by the Wizard.
  2. Select the table to include in the SQL statement.

    • The Wizard now displays a list of 'Available Fields' associated with the selected table.
      • In this example, 'PO' is the selected table.
  3. Select one or more fields to include.
    • This represents the specific fields the that will be included in the SQL statement created.
      • In this example, the following fields will be selected:
        • Purchase Order Number
        • Purchase Order Total
        • Vendor Code
        • Vendor Description
  4. Click 'Select' to add the field(s) to the Selected Fields grid.
    • Clicking 'Select All' would place all the Available Fields in the Selected Fields grid at one time.
  5. (OPTIONAL) Select another table and additional fields.
    • Once fields have been selected from the first table chosen, a second table can be selected from the grid to add to the SQL statement.
      • In this example, 'PODet' will be selected from the Related Tables box (or selected in the Available Table dropdown menu) and 'Part Number' added to the Selected Fields grid.
    • A maximum of 2 (two) tables can be selected for use in the Wizard.

    Query Wizard

  6. Click 'Next.'
    • If 2 tables were selected, the Wizard next displays the 'Join Tables' screen.
Join Tables (CONDITIONAL)
  1. (CONDITIONAL) Select the fields to use to 'Join Tables.'
    • By default the Wizard selects a field from each table as the "join" criteria, but these can be edited.
      • In this example, 'Purchase Order Number' is the common field used and will remain that way.
      • The tables MUST be joined by a field that is present in both of them in order for the query to successfully return information.
  2. (CONDITIONAL) Click 'Next.'
    • The 'Search Criteria' screen displays.
    • If only 1 (one) table was selected on the 'Field Selection' screen, the Wizard would skip the 'Join Tables' screen and go directly to 'Search Criteria.'
Select Search Criteria
  1. Open the 'Field' dropdown menu and select the first value to use.
    • Only the 'Selected Fields' are displayed.
      • In this example, 'POdet.Part Number' will be selected.
  2. Open the 'Criteria' dropdown menu and select the criteria to apply to the selected field.
    • Though they may vary based on the field selected, options will include items such as 'Equal To', 'Greater Than', 'Less Than', etc.
      • This example will use 'Equal To.'
  3. Select the desired 'Value' option.
    • Select 'Search for specific value' if the Hot Spot should always use a specified value, eliminating the need for user input.
    • Select 'Prompt the user for a search value' if the user should be required to provide information for the Hot Spot.
      • Given that Triggers monitor for a specified activity, the only practical option here is 'Search for specific value.'
  4. The action required for this step depends on what option was selected for the 'Value' radio button (Step 12.)
    • 'Search For Value'' - Select the appropriate value from the dropdown menu.
      • The values will vary based on the Field selected.
        • When entering values manually, make sure they match EXACTLY to ensure the query returns the desired results.
        • Due to syntax issues, double quotes (") should NEVER be used in fields that may be used in queries.
        • This example uses Part Number, so a part from the local database (WASHER) will be entered.
    • 'Prompt User' - Enter the message that should appear in the prompt provided and click 'OK.'
      • The Wizard will provide a message by default, such as 'Enter Part Number' (since that is the Field that was selected.)
      • This option would not be practical for use on Triggers.
  5. Click 'Add Criteria.'
    • This must be done to add the criteria to the query.
  6. (OPTIONAL) Add more criteria to the query by repeating steps 10 - 14.
    • This can be done to either expand the list of values to look for or to narrow the possible instances of getting a result.
    •  When additional criteria are added, the 'Apply Criteria As' radio button becomes required.
      • Selecting 'And' causes the resulting SQL statement to return results only if both / all criteria are met.
      • Selecting 'Or' causes the resulting SQL statement to return results so long as either / any of the criteria are met.
      • For example, if 'PO.Vendor Code' was selected as an additional (Equal To) Criteria :
        • Selecting 'And' would result in a query that returned results only if BOTH Part Number AND Vendor Code matched the provided values. (Results narrowed.)
        • Selecting 'Or' would result in a query that returned results so long as EITHER Part Number OR Vendor Code matched the provided values. (Results expanded.)
    • This example will only use 'PODet.PartNumber' as the Criteria.
  7. Click 'Next.'
Select Sort Option For Results
  1. Open the 'Sort By' dropdown menu and select how the Trigger will sort the information displayed if an action occurs that meets the stated criteria.
    • This example will use 'PO.PurchaseOrderNumber.'
  1. Click 'Finish.'
    • The result of the selections made displays in the 'SQL Query' field.
    • Any values already present would be overwritten.

      Results of Wizard

  2. Complete the remainder of the Trigger Details as appropriate.
  3. Click 'OK' to save the Trigger.