Checkboxes store CHAR, NUMBER, or DATE values. The value of a checkbox can be set by a fetch from a corresponding database column, by end user input via item manipulation, or through initial value or runtime assignment. Similarly, the value of a checkbox can be committed to the database through standard commit processing.
When you define a checkbox, you specify what value you want the checkbox to represent as checked and what value you want it to represent as unchecked.
For instance, consider a checkbox that indicates whether or not a customer has been approved for credit. When you define the checkbox, you could specify the Value when Checked to be 'CREDIT_OK' and the Value when Unchecked to be 'NO_CREDIT'.
When a customer record is fetched, the checkbox stores the value retrieved from its corresponding database column. If the fetched value is 'NO_CREDIT,' the checkbox is displayed in the unchecked state (off). If the end user activates the checkbox to toggle it to the checked state (on), the checkbox value changes to the checked value, 'CREDIT_OK.'
When you create a checkbox, you must specify how you want it to handle any fetched or assigned value that is not one of the values represented by the checked or unchecked states. (Note that the undefined state is used only in Enter Query mode. A value cannot be associated with the undefined state).
You can specify that a checkbox handle such Other Values in one of three ways:
In the previous example, you might specify that the Credit Approved checkbox display any Other Values as unchecked (off). Then, if a fetched record were to return the value 'PENDING', the checkbox would be unchecked, indicating that the customer's credit had not yet been approved. In this example, only the value 'CREDIT_OK' sets the state of the checkbox to checked, and all Other Values are displayed as unchecked.
When a value other than the checked or unchecked value is fetched or assigned to a checkbox, the state of the item can be either checked or unchecked, but the value of the item remains the Other Value until a new value is fetched or assigned, or until the end user toggles the state of the checkbox.
The following table shows the possible states and values for the example checkbox:
Fetched or Assigned Value |
Checkbox State |
Checkbox Value |
State/Value After End User Toggles checkbox |
---|---|---|---|
CREDIT_OK |
checked |
CREDIT_OK |
unchecked/NO_CREDIT |
NO_CREDIT |
unchecked |
PENDING |
checked/CREDIT_OK |
PENDING |
unchecked |
PENDING |
checked/CREDIT_OK |
123ABC |
unchecked |
123ABC |
checked/CREDIT_OK |
About defining checkboxes, radio groups, and list items for querying