This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided “as is” with no warranties.

Objective

To select and deselect all items in a Choice control on a single click.

Image

Before You Begin

This is applicable to a Choice control configured to display as a Check Box List as it allows multiple selections.

How-to Steps

  1. Add a Check Box control called Select All Check Box that will be used to either select or deselect all the items in the Choice control.
  2. Drag a Text Area control to the canvas. This will be used to set the value of the Choice control.
  3. Create an unbound rule called For All Choices as follows:
    - for All tems in Choice list control
       - then transfer data 

    Image
    Configure the Transfer Data action so that it passes the ID of the SmartObject bound to the Choice control to the Text Area control with the Text Area appended:
     Image
  4. Add a rule for when the Select All Check Box control is changed, it toggles the selection on the items in the Choice control.
    Image
    On the else clause, map the Text Area control to an empty value.
    Image
    Outside the if-else, call a transfer data so that the value of the Text Area control is mapped to the Choice control.
    Image