Adding Action to Run 2nd Operation That Remembers Rows Selected:
To add an action that calls another operation and displays rows selected from the 1st operation, use the following steps:
Create 1st Operation:
Create 1st operation that allows for selection:
Set Key Fields to Global:
For any field from operation 1 that you need WOW to remember for future operations, change the field's FD (Field Descriptor) so that it's usage ID = -3 (Global). In our case, we want the employee ID.
Create 2nd Operation:
Create a 2nd operation that filters the results based on previously selected rows (1st operation).
Notice the use of the global parameter (??!fieldname) within the IN clause. When the 2nd operation runs,
WOW will replace ??!EMPNO with something like:
EMPNO IN (101,135,1002)
The values 101, 135, and 1002 are the EMPNO values from 3 selected rows.
Create Action on 1st operation to Run 2nd Operation:
When a table driven RowCollection action is defined to run a 2nd operation and 1 or more fields from the operation are set to global, WOW will save the selected row information for each global field. In order to provide an action button on the 1st operation that runs the 2nd operation, set something similar to the following:
Entry Type: Action
Entry SubType: RowCollection (Table)
Source Operation: Operation where action is rendered.
Operation: Operation the action runs
Display Type: Button
Label: Button text
This action adds a button at the bottom of the results (table) generated by operation Employees:
So now if operation 1 (Employees) is run and a user selects the last 2 rows and then clicks on the Show Selected Rows button, WOW:
1) Saves the selected rows and stores them for global field EMPNO
2) Prepares the 2nd operation (Previously Selected Employees)
3) Sees the operation's SQL referencing a global variable in an IN clause (utilizes multiple values):
SELECT EMPNO,FIRSTNME, MIDINIT, LASTNAME, JOB, WORKDEPT, mgrnum, BIRTHDATE
FROM PJDATA.EMPLOYEE WHERE EMPNO IN ??!EMPNO
4) Finds a RowCollection for EMPNO and substitutes in all empno values:
SELECT EMPNO,FIRSTNME, MIDINIT, LASTNAME, JOB, WORKDEPT, mgrnum, BIRTHDATE
FROM PJDATA.EMPLOYEE WHERE EMPNO IN (000020, 000030, 000050)
5) Runs the altered SQL