Summary
WAM010 - Using WEB_MAPs
Important Observations
- The WEB_MAP statement allows you to specify which incoming and outgoing fields the WebRoutine maps between the web page and the RDMLX code. The WEB_MAP statement's FOR() selector specifies whether the fields are mapped as incoming (*INPUT), outgoing (*OUTPUT), or both (*BOTH).
- Only fields in a WEB_MAP statement with a FOR(*OUTPUT) or FOR(*BOTH) can be placed on the web page.
- The Fields() attributes specify the display mode of the field on the page. Acceptable field attributes are *INPUT, *OUTPUT and *HIDDEN. If unspecified, the default is *INPUT. These attributes determine whether the field accepts input, as an input text box, only displays an output value, or is hidden on the page.
- Hidden fields may be needed if fields that are shown as output values on the web page, but their value must be posted to the web server. This is often the case for key fields when the WebRoutine is performing an update.
- The order in which fields appear when generated is the same as their sequence in the WEB_MAPs, although when data is mapped to and from the WEB_MAPs they are mapped by field names and not position.
- A WebRoutine may have multiple WEB_MAPs.
- If the output of one WebRoutine does not match the input of the WebRoutine that it is calling, no error will be generated. The data will simply not be passed into the WebRoutine that was called.
Tips & Techniques
- In addition to specifying WEB_MAPs inside WebRoutine blocks, you are allowed to declare WEB_MAPs inside a BEGIN_COM block of a WAM. This technique allows you to map fields and lists into every WebRoutine in your WAM without having to explicitly define WEB_MAPs in each WebRoutine.
- You can change the WEB_MAP after the first compile, but you must update the web page for the fields affected. e.g. if a field's display attribute was changed in the WEB_MAP from *input to *output, the web page could be corrected either by changing the field on the page to "Output Field" or delete the field and drag and drop it onto the page from the WebRoutine Output tab.
- You can modify the display mode of a field in the Design view without having to change the WEB_MAP by right clicking the field and changing to the appropriate display mode. However, note that if you change a field to be *INPUT in the Design view, then it must be mapped into the WebRoutine using For(*input) or For(*both) in order for the value to be processed.
- Similarly if you change a field to be *OUTPUT in the Design view, and it is mapped into the WebRoutine as For(*input) the field value will never be received by the WebRoutine.
- For consistency, we recommend you control field input and output attributes via their WEB_MAP statements, rather than by tweaking the Design view.
What I Should Know