Difference between revisions of "Multiple Checkboxes"
From AgileApps Support Wiki
imported>Alice (Added Orientation information) |
imported>Aeric |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
Multiple | Multiple [[Checkbox]]es provide options in a field to make multiple selections. Checked boxes have a value of "Yes/True" and unchecked boxes are "No/False" | ||
To create values in a Multiple Check Box: | To create values in a Multiple Check Box: | ||
Line 6: | Line 6: | ||
#Enter each value on a new line; In this example, shoe sizes are listed: | #Enter each value on a new line; In this example, shoe sizes are listed: | ||
#:[[Image:Multicheckbox.gif|none|thumb]] | #:[[Image:Multicheckbox.gif|none|thumb]] | ||
In the record, the Multiple Check Boxes will appear as follows: | In the record, the Multiple Check Boxes will appear as follows: | ||
Line 18: | Line 17: | ||
*When displayed horizontally, the labels are shown on the same line, separated by commas | *When displayed horizontally, the labels are shown on the same line, separated by commas | ||
For Multiple Check Box fields where the labels include commas, vertical orientation is the better choice | For Multiple Check Box fields where the labels include commas, vertical orientation is the better choice. | ||
;Considerations: | |||
{{: | :* The value stored in the database is a comma-separated list of labels, one for each selection. So: | ||
::* If you change the order of the values, new values may be stored differently than old ones. | |||
::* To avoid a [[Data Truncation Error]] at runtime, make sure the field is large enough to contain all possible selections. | |||
::* Calculate the size as the sum of the entry lengths, plus N-1 for the commas between them, where N is the number of entries. | |||
:* To test for a checkbox selection in a Rule condition, use <tt>{fieldName} contains {checkboxLabel}</tt> | |||
::: (Single quotes are automatically added around the label to create a valid expression.) | |||
:* The easiest way to change the value of the field (for example) is to assign it a value that is a comma-separated list of checkbox labels. For example: 'Apples,Oranges,Bananas", where "Apples" is the label for the first checkbox, and so on. | |||
:* Use an expression like this one to mark a single box in a [[Rule]] action: | |||
::: <tt>IF( ISNULL(field), 'checkboxLabel', field+', checkboxLabel')</tt> | |||
::::* If the field is empty, the label is assigned to it. If the field has a value, the checkbox label is appended to it. | |||
::::* The checkbox label is case-sensitive, and must match the configured value exactly. | |||
::::* Spaces are allowed between items in the value-list (but be sure to size the field appropriately.) | |||
:* To uncheck a box in a rule, you need one of two expressions: | |||
::: <tt><nowiki>REPLACE(field, ', checkboxlabel', '')</nowiki></tt> - for multiple selections, or | |||
::: <tt><nowiki>REPLACE(field, 'checkboxLabel', '')</nowiki></tt> - for a single selection | |||
:: The expressions then need to be placed inside of a nested IF statement to see if either one applies: | |||
::: <tt><nowiki>IF (CONTAINS(field, ', checkboxLabel'), -first replacement-,</nowiki></tt> | |||
:::: <tt><nowiki>IF (CONTAINS(field, 'checkboxLabel'), -second replacement-, field) )</nowiki></tt> | |||
::::* This expression does the appropriate substitutions of the label is present. Otherwise, it returns the original field. |
Latest revision as of 23:48, 2 April 2014
Multiple Checkboxes provide options in a field to make multiple selections. Checked boxes have a value of "Yes/True" and unchecked boxes are "No/False"
To create values in a Multiple Check Box:
- See the instructions to add a Field
- Select the Multiple Check Boxes display type
- Enter each value on a new line; In this example, shoe sizes are listed:
In the record, the Multiple Check Boxes will appear as follows:
Although the labels for the enumerated values may contain commas, the enumerated values may not contain commas
The orientation can be vertical or horizontal
- When displayed vertically, each label is shown on a separate line
- When displayed horizontally, the labels are shown on the same line, separated by commas
For Multiple Check Box fields where the labels include commas, vertical orientation is the better choice.
- Considerations
-
- The value stored in the database is a comma-separated list of labels, one for each selection. So:
- If you change the order of the values, new values may be stored differently than old ones.
- To avoid a Data Truncation Error at runtime, make sure the field is large enough to contain all possible selections.
- Calculate the size as the sum of the entry lengths, plus N-1 for the commas between them, where N is the number of entries.
- To test for a checkbox selection in a Rule condition, use {fieldName} contains {checkboxLabel}
- (Single quotes are automatically added around the label to create a valid expression.)
- The easiest way to change the value of the field (for example) is to assign it a value that is a comma-separated list of checkbox labels. For example: 'Apples,Oranges,Bananas", where "Apples" is the label for the first checkbox, and so on.
- Use an expression like this one to mark a single box in a Rule action:
- IF( ISNULL(field), 'checkboxLabel', field+', checkboxLabel')
- If the field is empty, the label is assigned to it. If the field has a value, the checkbox label is appended to it.
- The checkbox label is case-sensitive, and must match the configured value exactly.
- Spaces are allowed between items in the value-list (but be sure to size the field appropriately.)
- IF( ISNULL(field), 'checkboxLabel', field+', checkboxLabel')
- To uncheck a box in a rule, you need one of two expressions:
- REPLACE(field, ', checkboxlabel', '') - for multiple selections, or
- REPLACE(field, 'checkboxLabel', '') - for a single selection
- The expressions then need to be placed inside of a nested IF statement to see if either one applies:
- IF (CONTAINS(field, ', checkboxLabel'), -first replacement-,
- IF (CONTAINS(field, 'checkboxLabel'), -second replacement-, field) )
- This expression does the appropriate substitutions of the label is present. Otherwise, it returns the original field.
- IF (CONTAINS(field, 'checkboxLabel'), -second replacement-, field) )
- IF (CONTAINS(field, ', checkboxLabel'), -first replacement-,