Check Boxes
A check box is a choice with associated text that requires a true/false, yes/no, on/off answer.
- It must be an alphanumeric field of length 1.
- Check boxes are defined through the CBOX input/output attribute. The maximum number of check boxes that may be defined for a function is 999.
- Identification must be either label (*LABEL) or no identification (*NOID). Label is the default.
- Within RDML the valid values for a check box field are "1" for selected and " " for unselected. Use of other values may produce unpredictable results.
- When on a NPT screen a check box is selected with a "/" or country-designated character (defined in the DC@OSVEROP *SELECTCHAR=x option) and unselected with a " ". This character is locked in at compile time for the best performance when executing.
- LANSA generated code handles the conversion between screen and RDML values for check boxes (i.e. from "/" to "1" when selected).
- A new system value named *CHECKBOXSELECTED has been created to be used when testing the return value of a check box field. Use of this system variable makes your RDML code "self-documenting".
- A check box may only contain one of two values. Therefore the best way to test its value is to check if it is *EQ (equal) or *NE (not equal) to the selected value (*CHECKBOXSELECTED).
- To test if a check box has been selected:
BEGIN_LOOP
REQUEST FIELDS(#SCREEN)
IF COND('#CBOX01 *EQ *CHECKBOXSELECTED')
MESSAGE MSGTXT('Check box 1 is selected')
ENDIF
IF COND('#CBOX02 *NE *CHECKBOXSELECTED')
MESSAGE MSGTXT('Check box 2 is not selected')
ENDIF
END_LOOP
the correct way to initialize check boxes:
CHANGE FIELD(#CHECKBOX1 #CHECKBOX2 #CHECKBOX3
#CHECKBOX4) TO(*NULL)
IF COND('#ACTIVE *EQ ''Y''')
CHANGE FIELD(#CHECKBOX2) TO(*CHECKBOXSELECTED)
ENDIF
CHANGE FIELD(#CHECKBOX4) TO(*CHECKBOXSELECTED)