Suppose we need to create a screen comprising a selection text which will dynamically fetch the data from different tables in Sage X3.
Let us proceed with an example as stated below:
The screenshot shown below consists of an option named “Then by” which comprises four different selection options. Each time this option changes, the “From” and “To” selection lookup should have the respective selection data.
For e.g. whenever the Vendor Number is selected the “From” and “To” text should display the Vendor Numbers, whereas, if the option is selected as Nature of Deduction Code the selection window should have Nature of Deduction in “From” and “To” columns.
To achieve this we have created an action code for that respective field as follows:
Standard Process file consists of the following code:
The SEL_TABLE is the action triggered when we select the data from any table, i.e. when, any user right clicks on the respective text field where selection event is present.
When “SEL_TABLE”: Gosub SEL_TABLE
As seen in the code above, the action intern calls the procedure SEL_TABLE
When “DOCTYPSEL”: Gosub S_SELPIA
The above code calls a subprogram by name S_SELPIA.
Local Decimal WTYP : WTYP = Val (PARAM (1))
Local Char WNUM (GLONVCR): WNUM = VALEUR
TIT (0) = mess(18,100,1)
CRITERE = “1=1”
Case [M] VCRTYPSEL
If!clalev([F:BPS]) : Local File BPSUPPLIER [BPS] : End if
Default File [BPS]GSELFAC = 1
OBJET = “BPS”
Filter [F: BPS]CRITERE = “BPSTYP=1”
SENS = 1
VALEUR = WNUM
DEFPAG = 1
As seen in the above code, the program works on different case statements for each selected parameter.
The following screenshot will give us a better understanding:
Thus, whenever the Vendor Number field is selected, the Selection window would display Vendor Numbers. similarly, if the Nature of Deduction is selected, it would thus select the Nature of Deduction data in Sage X3 [as seen in the above image].