Adding Columns to a Standard Query Facet

This document provides information on how to add columns to a standard Query facet.

The process described below demonstrates how to use a standard Query facet as the basis for an enhanced Query facet that includes the original and additional columns.

  1. Link the "lookup" of one or more properties to a standard representation class.
    Refer to Modifying the selections Query facet for a standard table for more information.
  2. If you need to add standard columns from the original data table, go to the Displayed Properties tab and add the properties you need to include in the Query facet.
    Select the Query check box for each new property, and set the Initial status field to "Visible".
  3. If you need to add columns that do not exist in the original data table:
    1. In the Properties block of the Properties tab, add the properties you need to include in the Query facet.
    2. In the Displayed Properties tab, add the properties you added in the Properties tab.
      Select the Query check box for each new property, and set the Initial status field to "Visible".
    3. In the Scripts block of the General tab, add script [data type code]_RSTD to populate the column values in the Query facet.
      For example, you can use the following script to add two new columns whose values are defined in a local menu:
          $METHODS
            Case CURPTH
              When ""
                Case ACTION
                  When "AQUERY_TRANS_AFTER    :   Gosub AQUERY_TRANS_AFTER
                Endcase
            Endcase
          Return
          $AQUERY_TRANS_AFTER
          Local Char PROPERTY1(30), PROPERTY2(30)
          If (PROPERTY1 <> "" & PROPERTY1 <> "1") # ignore blank and first '- Select -' option
            this.PROPERTY1 = mess(val(PROPERTY1), [local menu code], 1)
          Else
            this.PROPERTY1 = ""
          Endif
          If (PROPERTY2 <> "" & PROPERTY2 <> "1") # ignore blank and first '- Select -' option
            this.PROPERTY2 = mess(val(PROPERTY2), [local menu code], 1)
          Else
            this.PROPERTY2 = ""
          Endif
          Return
  4. Perform a global validation on your representation class before it can be used in Sage X3. It should validate:
    • The associated data class.
    • Any child classes of the associated data class.
    • The representation class.
  5. Click Options > Global validation on the right-hand panel of the representation class to perform a global validation.

Completed result

  • The property will allow the selection of a value using the magnifying glass displayed in the field. The Query facet displayed when the magnifying glass is selected is the standard display for the original data type, with the additional columns you added.
  • If the new columns were standard columns from the original data table, the column values will be displayed automatically.
  • If the new columns were columns that did not exist in the original data table, the script will call the column values from the local menu.