Note | ||
---|---|---|
| ||
As of July 25th, 2023, there is a content freeze on this page. |
Starting in release 5.8.0, Profound.js supports the usage of data structure parameter in the plugins "Call IBM i Program" and "Call Service Program Procedure". This page documents two examples of that usage.
...
- The subfield names as defined in low-code dialog "Define Data Structure Fields" do not have to match the field names as defined in the RPG program.
- However, the attributes (data type, length, etc) must match.
- Nested data structures are supported. You can define a subfield as data type "data structure", then right click on the subfield and take option "Add child subfield" to define the subfields for that data structure subfield. Below is an example where the subfield "addr" is a data structure made up of four child subfields.
- If you specify the option "capture output" as "Into work variable":
- You do not have to declare the work variable previously; it's declared for you.
- The work variable is a JavasScript object, with one property for each subfield of the data structure, so in low-code you can refer to each "subfield" as
workvar.subfield
. - In the actual PJS code generated for the plugin, API pjs.toObject() is used to convert the data from the RPG data structure into the JavaScript object
workvar
. You can refer to that API for more information.
- If you have the RPG code for the parameter interface, you do not have to manually define the parameters. You can click button "Extract parameters from RPG code snippet", paste the RPG code, and click button "Generate Parameters". The definitions for all parameters (including data structure parameters) are populated for you in the low-code plugin panel. For a data structure parameter, after it's extracted from the RPG code, you can click button "Define subfields..." to verify that the subfield definitions are correct as extracted.
...