|
Examples
The following RDML program uses the *HIDDEN and *SELECT attributes and requests that the user input a generic customer name. All customer names that match are displayed and any of them can be selected for detailed display:
DEFINE FIELD(#CHOOSE) TYPE(*CHAR) LENGTH(1) COLHDG('Sel')
DEF_LIST NAMED(#BROWSE) FIELDS((#CHOOSE *SELECT) #NAME (#CUSTNO *HIDDEN))
GROUP_BY NAME(#CUSTOMER) FIELDS(#CUSTNO #NAME #ADDR1 #ADDR2 #POSTCD)
REQUEST FIELDS(#NAME)
CLR_LIST NAMED(#BROWSE)
SELECT FIELDS(#BROWSE) FROM_FILE(CUSMSTV1) WITH_KEY(#NAME) GENERIC(*YES)
ADD_ENTRY TO_LIST(#BROWSE)
ENDSELECT
DISPLAY BROWSELIST(#BROWSE)
SELECTLIST NAMED(#BROWSE) GET_ENTRYS(*SELECT)
FETCH FIELDS(#CUSTOMER) FROM_FILE(CUSMST) WITH_KEY(#CUSTNO)
DISPLAY FIELDS(#CUSTOMER)
ENDSELECT
Some points to note about this RDML program are:
Sel Customer name
_ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
_ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
_ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Note the input capable "Sel" column. This resulted from assigning the *SELECT attribute to field #CHOOSE.
Notice also that field #CUSTNO does not appear on the display. This is because it has attribute *HIDDEN. Even though it is not on the display it is still part of each list entry and is used in the final loop to fetch the required customer record for detailed display.
The *SELECT attribute can also be used in various other ways. Consider the following example:
DEFINE FIELD(#CHOOSE) TYPE(*CHAR) LENGTH(3) COLHDG('Sel')
DEF_LIST NAMED(#BROWSE) FIELDS((#CHOOSE *SELECT) #ORDER #DATDUE)
REQUEST FIELDS(#DATDUE)
CLR_LIST NAMED(#BROWSE)
SELECT FIELDS(#BROWSE) FROM_FILE(ORDHDRV3) WITH_KEY(#DATDUE)
ADD_ENTRY TO_LIST(#BROWSE)
ENDSELECT
DISPLAY BROWSELIST(#BROWSE)
--> SELECTLIST NAMED(#BROWSE) GET_ENTRYS(*SELECT)
|
| CASE OF_FIELD(#CHOOSE)
|
| WHEN VALUE_IS('= CUS')
| < display customer details >
| WHEN VALUE_IS('= DET' '= LIN')
| < display line item details >
| WHEN VALUE_IS('= HIS')
| < display customer payment history >
| WHEN VALUE_IS('= STS')
| < display order status >
|
| ENDCASE
|
--- ENDSELECT
Sel Order Date Due
_ 9999999 99/99/99
_ 9999999 99/99/99
_ 9999999 99/99/99
_ 9999999 99/99/99