Display file source: PUISAMPLES/QDDSSRC(GRID001D)
RPGLE source: PUISAMPLES/QRPGLESRC(GRID001R)
Subfiles are lists of items. They are created using grid widgets in Profound UI. To create a simple subfile, follow these steps:
- Create the grid
Drag a new subfile grid widget on the canvas.
- Create columns
You can add or remove columns by using the plus and minus icons on the right side of the grid.
- Size Columns
You can resize columns by dragging the column’s vertical border from side to side.
- Set headings
Double-click into each column’s heading to modify the heading text and formatting.
Alternatively, if the subfile in your application does not need headings, set the has header property to false.
- Add subfile fields
To add fields to the subfile, drag and drop other widgets into the first row of the subfile and then bind them to RPG fields. For example, to output the Product Id, drag the Dynamic Output Field widget into the first row of the Product Id column.
The column will be highlighted, right before you drop the element. Once the element is dropped, it will repeat to all rows within the subfile.
Now, bind the value property to the appropriate RPG field. This can be done by double-clicking the widget.
Note: In addition to output fields, most other widgets can also belong in a subfile, including action elements like buttons and hyperlinks, and input elements like checkboxes and dropdowns.
- Set up number of visible rows
You can add or remove visible rows by selecting the plus and minus icons at the bottom of the grid.
- Control alignment
Field alignment can be controlled through the widget’s text align property, which can be accessed in the Properties Window once the widget is selected or by using the Formatting section of the Edit toolbar in the Ribbon. For output fields, you must ensure that the element has a predefined width. This can be accomplished by resizing the element horizontally or setting the width property manually in the Properties Window.
- Setting the clear subfile indicator
The grid component contains a number of properties that allow you to control it through server-side RPG coding. One critical property is clear subfile, the equivalent of the CLRSFL keyword from traditional green-screen programming. It is conventional to clear the subfile before loading it with data. To accomplish this, bind the clear subfile property to an indicator field. Then, in your RPG code, set the indicator and write the subfile control record to clear the subfile.
- Setting record format names
Before utilizing the grid in your RPG code, you must set record format names for the subfile and for the screen that contains the subfile, which is referred to as the subfile control record.
To set the subfile record format, select the grid, and modify its record format name property.
To set the subfile control record format, click the canvas to select screen properties, and then set the record format name property.
These changes will be reflected in the Record Format List in the top right area of the visual designer.
Writing the RPG
The RPG code to load the subfile with data may look as follows:
- Equivalent PHP code would look as follows: