Actions within the subfile can be triggered with buttons, hyperlinks, dropdowns or similar elements. In the RPG code, the ReadC operation (Read Next Changed Record) can be used to retrieve the selected record.
For example, in the product subfile, you may wish to add a new hyperlink for viewing product details, and then bind the hyperlink’s response property to an RPG variable named ViewLink. Consequently, you can add the following RPG code to process the click:
If Not %Eof();
SFLRow = RRN;
When linkView = *On;
Alternatively, instead of adding a new hyperlink, you can also right-click the PRID subfile field in the designer and select the option to change it to a hyperlink. Then, assign the response property.
If the subfile requires more than one action, such as view, change, and delete, you may add several hyperlinks and bind their response properties to different RPG indicator variables; or you can you utilize a dropdown widget. When you bind the dropdown’s value property, the ReadC operation in RPG will automatically retrieve it. To make the dropdown initiate the action right away, add pui.click() to its onchange event.
Note: At runtime, a period and the subfile row number is appended to element IDs within a subfile. So, the first instance of viewLink will be viewLink.1, the second will be viewLink.2, etc.