How to add columns to a standard query facet
See also: How to modify the selections (Query facet) for a standard data table.
This document describes how to use a standard Query facet as the basis for an enhanced Query facet.
This ‘How-to’ provides information on how to modify the columns in a standard Query facet.
The following development process demonstrates how to use a standard Query facet as the basis for an enhanced Query facet which includes the original and additional columns:
Link the ‘lookup’ for one or more properties to a standard representation class.
See How to modify the selections (Query facet) for a standard data table.
Add the new properties to be included as additional columns in the Query facet to the representation class definition.
a) If adding standard columns from the original data table:
b) If adding columns that do not exist in the original data table:
[data type code]_RSTD
with the appropriate script code. For example, the following script could be used for two new columns that have values defined in a Local menu:
``
CODECODE CODE
$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") ha$h ignore blank and first '- Select -' option
this.PROPERTY1 = mess(val(PROPERTY1), [local menu code], 1)
Else
this.PROPERTY1 = ""
Endif
If (PROPERTY2 <> "" & PROPERTY2 <> "1") ha$h ignore blank and first '- Select -' option
this.PROPERTY2 = mess(val(PROPERTY2), [local menu code], 1)
Else
this.PROPERTY2 = ""
Endif
Return
````
Perform a global validation on the representation class.
You must perform a global validation on your representation class before it can be used in Sage X3. A global validation will validate:
Click Options > Global validation on the right panel of the representation class to perform a global validation.
The property will allow selection (magnifying glass is displayed in the field) of a value. The Query facet displayed when the magnifying glass is selected will be the standard display for the original data type with the additional columns added in step 2.
If the new columns were standard columns from the original data table (see step 2a) the column values will be displayed automatically.
If the new columns were columns that did not exist in the original data table (see step 2b) the script will call the column values from the Local menu.