Example 1: Display fields #ORDNUM, #CUSTNUM and #DATEDUE to the user.
DISPLAY FIELDS(#ORDNUM #CUSTNUM #DATEDUE)
or, identically:
GROUP_BY NAME(#ORDERHEAD) FIELDS(#ORDNUM #CUSTNUM #DATEDUE)
DISPLAY FIELDS(#ORDERHEAD)
both use default values for all parameters and field attributes and thus would cause a screen something like this to be designed automatically:
|
Example 2: Modify the previous example to design the screen across ways and use column headings to identify the fields:
GROUP_BY NAME(#ORDERHEAD) FIELDS(#ORDNUM #CUSTNUM #DATEDUE)
DISPLAY FIELDS(#ORDERHEAD) DESIGN(*ACROSS) IDENTIFY(*COLHDG)
which would cause a screen something like this to be designed automatically:
|
Example 3: Display #ORDNUM #CUSTNUM and #DATEDUE and also specify specific positions and identification methods as field attributes.
For details of field attributes, refer to Field Attributes and their Use.
When specific positions for a field are nominated the automatic design facility is effectively "disabled".
GROUP_BY NAME(#ORDERHEAD) FIELDS((#ORDNUM *COLHDG *L3 *P3 ) (#CUSTNUM *LABEL *L3 *P24) (#DATEDUE *NOID *L7 *P37))
DISPLAY FIELDS(#ORDERHEAD) DESIGN(*ACROSS) TEXT(('--DATE--' 6 37) ('--------' 8 37))
which would cause a screen something like this to be designed:
|
Note: The manual specification of row and column numbers and "text" is not required. The screen design facility can be used to modify an "automatic" design much more quickly and easily. Refer to The Screen Design Facility in the LANSA for i User Guide for details of how to use the screen design facility.
After the screen design facility has been used on a DISPLAY command the associated FIELDS parameter (in the DISPLAY or GROUP_BY command) will be automatically re-written with the required row, column and method of identification attributes. Remember, if an expandable group expression was used, LANSA will substitute the expression with the fields that constitute it.
In addition the TEXT parameter of the DISPLAY command will also be automatically re-written.
Example 4: Display the order header details used in the previous example and all the associated invoice lines nominated in a list named #ORDERLINE:
GROUP_BY NAME(#ORDERHEAD) FIELDS(#ORDNUM #CUSTNUM #DATEDUE)
DEF_LIST NAME(#ORDERLINE) FIELDS(#ORDLIN #PRODUCT #QUANTITY #PRICE)
DISPLAY FIELDS(#ORDERHEAD) BROWSELIST(#ORDERLINE)
Since default values were used for all parameters and no field attributes were specified a screen something like this would be designed automatically:
|
Example 5: Display the order header details used in the previous example and all the associated invoice lines nominated in a list named #ORDERLINE which only has 4 entries. Display invoice line totals (which can be adjusted) below the invoice lines:
GROUP_BY NAME(#ORDERHEAD) FIELDS(#ORDNUM #CUSTNUM #DATEDUE)
DEF_LIST NAME(#ORDERLINE) FIELDS(#ORDLIN #PRODUCT #QUANTITY #PRICE)
DISPLAY FIELDS(#ORDERHEAD) BROWSELIST(#ORDERLINE 4) OPTIONS(*NOREAD)
REQUEST FIELDS(#TOTQTY #TOTPRICE) OPTIONS(*OVERLAY)
after screen painting to adjust the field positions to avoid overlapping, the resulting screen (after executing the above code) would look something like this:
|
Example 6 : Use an expandable group expression and redesign the layout using the screen design facility:
GROUP_BY NAME(#XG_ORDHDG) FIELDS(#ORDNUM #CUSTNUM #DATEDUE)
DISPLAY FIELDS(#XG_ORDHDG) DESIGN(*ACROSS) IDENTIFY(*COLHDG)
The screen designed automatically would look like this:
|
If the layout is changed using the screen design facility to look like this:
|
then the DISPLAY command FIELDS parameter will be expanded as follows:
DISPLAY FIELDS((#ORDNUM *L2 *P3) (#CUSTNUM *L2 *P37) (#DATEDUE *L5 *P26 *LAB)) DESIGN(*ACROSS) IDENTIFY(*COLHDG)