<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Need checkboxField to deselect options when certain options are selected.</title><link>https://community.appian.com/discussions/f/user-interface/20435/need-checkboxfield-to-deselect-options-when-certain-options-are-selected</link><description>I have an ask to make a checkbox field have the following logic. 
 Checkbox has four items. If option ITEM 1 is selected then selection of ITEM 2, ITEM 3, ITEM 4 should be deselected automatically. 
 If options ITEM 2, ITEM 3, ITEM 4 are selected then</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Need checkboxField to deselect options when certain options are selected.</title><link>https://community.appian.com/thread/79802?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2021 19:10:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a3589757-59fd-4b27-8800-83869c7f85c0</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;Ok gotcha - the main thing I wanted to get at here is that&amp;nbsp;the example provided below might provide the functionality you&amp;#39;re looking for, but it also has the potential to be confusing. Personally I would find it confusing if certain options are conditionally selected or not selected, so sometimes it can be easier to split into multiple sets of checkboxes to ensure users fully understand the options.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need checkboxField to deselect options when certain options are selected.</title><link>https://community.appian.com/thread/79799?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2021 18:29:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fc3fc1b3-4428-499d-a68c-e255f78200f1</guid><dc:creator>felixl0004</dc:creator><description>&lt;p&gt;Hi Peter, we can consider different design patterns because ITEM 1 represents a special&amp;nbsp;selectable item. Not necessarily a select all but an mutually exclusive option from the rest of the check boxes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need checkboxField to deselect options when certain options are selected.</title><link>https://community.appian.com/thread/79791?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2021 16:21:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0c0a82ad-156f-4148-a307-b5de878b3b47</guid><dc:creator>felixl0004</dc:creator><description>&lt;p&gt;Hi Chris,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for your checkbox example. The refresh should meet customer&amp;#39;s ask.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need checkboxField to deselect options when certain options are selected.</title><link>https://community.appian.com/thread/79712?ContentTypeID=1</link><pubDate>Fri, 19 Feb 2021 19:03:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d197da27-06f1-47c8-afc9-8bed221b2c0b</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Due to this behavior of not updating until an additional click is made outside of the form, I&amp;#39;ll typically implement a setup with multiple checkboxes, one for each option.&amp;nbsp; In this scenario, the updates are persisted as soon as you choose a value.&amp;nbsp; Try the example below.&amp;nbsp;&amp;nbsp;This uses an interim local variable that always has the same length as the options, then the output variable rejects nulls for your final list.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;a!localVariables(
  local!options: {&amp;quot;ITEM 1&amp;quot;,&amp;quot;ITEM 2&amp;quot;,&amp;quot;ITEM 3&amp;quot;,&amp;quot;ITEM 4&amp;quot;},
  local!selected: repeat(count(local!options),null),
  local!selected_output: reject(fn!isnull,{local!selected}),
  {
    a!forEach(
      items: local!options,
      expression: a!checkboxField(
        choiceLabels: local!options[fv!index],
        choiceValues: local!options[fv!index],
        value: local!selected[fv!index],
        saveInto: {
          local!selected[fv!index],
          if(
            and(fv!isFirst,not(isnull(local!selected[1]))), /* Populating Item 1 */
            a!save(local!selected,{local!options[1],repeat(count(local!options)-1,null)}),
            if(
              and(not(fv!isFirst),not(isnull(local!selected[fv!index]))), /* Populating Items 2-4 */
              a!save(local!selected,{null,index(local!selected,2+enumerate(count(local!options)-1))}),
              {}
            )
          )
        }
      )
    ),
    a!textField(
      label: &amp;quot;Selected (output): &amp;quot;, 
      value: local!selected_output, 
      readOnly: true
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need checkboxField to deselect options when certain options are selected.</title><link>https://community.appian.com/thread/79676?ContentTypeID=1</link><pubDate>Thu, 18 Feb 2021 19:14:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6ffb0ac4-d353-4102-8239-548ba30eb9c5</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;I&amp;#39;m curious about your use case - is the goal here to have item 1 show as &amp;quot;Select All&amp;quot; and also allow them to choose individual items? If that&amp;#39;s the case, I&amp;#39;d probably suggest a different design pattern entirely to meet your goal. For instance, you could create a link that says &amp;quot;Select All&amp;quot; which would then save all of the selections at once. Then, if any item is deselected, you don&amp;#39;t need to update any other checkboxes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need checkboxField to deselect options when certain options are selected.</title><link>https://community.appian.com/thread/79672?ContentTypeID=1</link><pubDate>Thu, 18 Feb 2021 18:10:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dc4fa96a-2a2f-4410-b25a-2491eb0899f5</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I can confirm this behavior - I assume this is an inherent effect of how the checkbox field is configured internally to behave.&amp;nbsp; Generally I don&amp;#39;t think it&amp;#39;s optimized with the assumption that its selected values will be altered procedurally (like you&amp;#39;re doing) rather than by literal user clicks.&amp;nbsp; If this is causing you grief, I suggest you open an Appian support case and include the same sample code and description you&amp;#39;ve written here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>