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.
- 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. - 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". - If you need to add columns that do not exist in the original data table:
- In the Properties block of the Properties tab, add the properties you need to include in the Query facet.
- 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". - 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: $METHODSCase CURPTHWhen ""Case ACTIONWhen "AQUERY_TRANS_AFTER : Gosub AQUERY_TRANS_AFTEREndcaseEndcaseReturn$AQUERY_TRANS_AFTERLocal Char PROPERTY1(30), PROPERTY2(30)If (PROPERTY1 <> "" & PROPERTY1 <> "1") # ignore blank and first '- Select -' optionthis.PROPERTY1 = mess(val(PROPERTY1), [local menu code], 1)Elsethis.PROPERTY1 = ""EndifIf (PROPERTY2 <> "" & PROPERTY2 <> "1") # ignore blank and first '- Select -' optionthis.PROPERTY2 = mess(val(PROPERTY2), [local menu code], 1)Elsethis.PROPERTY2 = ""EndifReturn
- 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.
- 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.