12.4.6 Hidden Field Attribute and the Select Field Attribute
Attributes |
Description |
*HIDE *HIDDEN |
These attributes are synonyms. Use of these attributes indicates that the field is to be "hidden" and not displayed on the screen. This attribute is primarily intended to allow fields to be included into a browse list but not actually displayed on the screen. Refer to the DEF_LIST command for more information about lists and list processing. |
*SEL *SELECT |
These attributes are synonyms. Use of this attribute indicates that a field is to be used to "select" an entry from a list. Fields with this attribute are input capable no matter what the display mode. Refer to the DEF_LIST and SELECTLIST command for more details of lists and list processing. |
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:
- The first block of executable commands requests that the user input a customer name and then builds a list of all customers that have a generically identical name.
- The first DISPLAY command displays the list built by the first block of code. When displayed the list would look something like this:
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 SELECTLIST / ENDSELECT loop causes entries in the list to be processed. The GET_ENTRYS(*SELECT) parameter indicates that only entries which have a non-blank value in field #CHOOSE should be selected for processing. Note the link between the GET_ENTRYS parameter and the *SELECT attribute in the DEF_LIST command.
- Within the SELECTLIST / ENDSELECT loop the field #CUSTNO which was defined as being in the list (but hidden from the user) is used to retrieve the correct customer record for the detailed display. This had to be done in this case because the field #NAME does not provide a unique key for the customer involved.
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
- Note that like the first example the commands request that a "date order due" be input. A list of all associated orders is then built and displayed. When displayed the list would look something like this:
Sel Order Date Due
_ 9999999 99/99/99
_ 9999999 99/99/99
_ 9999999 99/99/99
_ 9999999 99/99/99
- The SELECTLIST / ENDSELECT loop requests that all entries in the list that have a non-blank value in field #CHOOSE be processed. However, the loop also acts upon the content of field #CHOOSE to display customer, line item, payment history or status information about the order.