<?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>All selected value must be present in the choiceValues array, but value was 2;4 and choiceValues was 4;3</title><link>https://community.appian.com/discussions/f/new-to-appian/37834/all-selected-value-must-be-present-in-the-choicevalues-array-but-value-was-2-4-and-choicevalues-was-4-3</link><description>hi team. 
 
 I have a requirement as: 
 I have to create data using some dropdown values and after creation of that data user can delete that data from where that drop data is coming and once data is deleted from frontend then 
 when user tries to edit</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: All selected value must be present in the choiceValues array, but value was 2;4 and choiceValues was 4;3</title><link>https://community.appian.com/thread/142240?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2024 17:36:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7f97edeb-dd10-4ff0-995b-e4af609e585d</guid><dc:creator>Shanmathi Ponnusamy</dc:creator><description>&lt;p&gt;&amp;nbsp;&lt;a href="/members/asfiyay2840"&gt;appian.user&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sample&amp;nbsp;code for you reference:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  /*Query the selected Ids saved*/
  local!selectedValues: { 1, 2, 3, 4 },
  local!allStatusList: {
    a!queryRecordType(
      recordType: &amp;#39;recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup&amp;#39;,
      filters: a!queryLogicalExpression(
        operator: &amp;quot;AND&amp;quot;,
        ignoreFiltersWithEmptyValues: true(),
        filters: {
          a!queryFilter(
            field: &amp;#39;recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup.fields.{16b61379-08fe-4d34-a71f-54c7366c94e4}lookupType&amp;#39;,
            operator: &amp;quot;=&amp;quot;,
            value: cons!CSCM_TXT_LOOKUP_TYPE_SERVICE_TYPE
          )
        }
      ),
      pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: cons!CSCM_INT_BATCH_SIZE_EXTRA_SMALL,
        sort: a!sortInfo(
          field: &amp;#39;recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup.fields.{c43d180d-159f-47b2-9e59-5487550b9bed}id&amp;#39;,
          ascending: true
        )
      )
    ).data
  },
  local!activeStatusList: index(
    local!allStatusList,
    wherecontains(
      true(),
      toboolean(
        index(
          local!allStatusList,
          &amp;#39;recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup.fields.{2bc67ffb-5c05-4e04-9d61-55fa46bc27a9}isActive&amp;#39;,
          null
        )
      )
    ),
    null
  ),
  local!activeStatusListIds: index(
    local!activeStatusList,
    &amp;#39;recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup.fields.{c43d180d-159f-47b2-9e59-5487550b9bed}id&amp;#39;,
    null
  ),
  local!deletedIdsFromList: difference(
    tointeger(local!selectedValues),
    tointeger(local!activeStatusListIds)
  ),
  local!currentlyActiveSelectValues: difference(
    local!selectedValues,
    local!deletedIdsFromList
  ),
  {
    a!multipleDropdownField(
      label: &amp;quot;Status&amp;quot;,
      placeholder: &amp;quot;--Select a value--&amp;quot;,
      choiceLabels: index(
        local!activeStatusList,
        &amp;#39;recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup.fields.{2bfd5d5e-b8b3-4cb8-aa22-f72c594b2c63}lookupValue&amp;#39;,
        null
      ),
      choiceValues: index(
        local!activeStatusList,
        &amp;#39;recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup.fields.{c43d180d-159f-47b2-9e59-5487550b9bed}id&amp;#39;,
        null
      ),
      value: local!currentlyActiveSelectValues,
      saveInto: local!currentlyActiveSelectValues
    ),
    a!richTextDisplayField(
      showWhen: a!isNotNullOrEmpty(local!deletedIdsFromList),
      value: a!richTextItem(
        color: &amp;quot;NEGATIVE&amp;quot;,
        text: &amp;quot;Attention: The below values which are selected are not currently active now -&amp;quot; &amp;amp; index(
          index(
            local!allStatusList,
            wherecontains(
              tointeger(local!deletedIdsFromList),
              tointeger(
                index(
                  local!allStatusList,
                  &amp;#39;recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup.fields.{c43d180d-159f-47b2-9e59-5487550b9bed}id&amp;#39;,
                  null
                )
              )
            ),
            null
          ),
          &amp;#39;recordType!{c7aaff95-ce56-464f-8cee-382355601ed8}CSCM Lookup.fields.{2bfd5d5e-b8b3-4cb8-aa22-f72c594b2c63}lookupValue&amp;#39;,
          null
        )
      )
    )
  }
)&lt;/pre&gt;&amp;nbsp;S&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/62/pastedimage1730136958489v1.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: All selected value must be present in the choiceValues array, but value was 2;4 and choiceValues was 4;3</title><link>https://community.appian.com/thread/142239?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2024 17:32:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2a56425f-f13f-4745-bb9e-3caf67889290</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Something simple could be this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!availableValues: {1,2,4,5},
  local!selectedValues: {3,5,6},
  local!finalValues: filter(
    contains(local!availableValues, _),
    local!selectedValues
  ),
  a!multipleDropdownField(
    choiceValues: local!availableValues,
    choiceLabels: local!availableValues,
    value: local!finalValues
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: All selected value must be present in the choiceValues array, but value was 2;4 and choiceValues was 4;3</title><link>https://community.appian.com/thread/142238?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2024 17:23:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d2eb7e05-9671-4364-880e-cda4b0f60b06</guid><dc:creator>Mike Schmitt</dc:creator><description>[quote userid="255133" url="~/discussions/f/new-to-appian/37834/all-selected-value-must-be-present-in-the-choicevalues-array-but-value-was-2-4-and-choicevalues-was-4-3/142235"]can you please suggest by coding [/quote]
&lt;p&gt;I don&amp;#39;t have time to assemble a working example at the moment (but if i get a chance i can look into it soon) - but in short, you need to learn to write manual code that prepares the necessary on-form local variables to allow you to do this.&amp;nbsp; For instance, you would query the default choices into an initial local variable.&amp;nbsp; Then you would declare another local variable that you will use to actually populate the choices, except in that local variable you check whether or not the existing options include all current selections (including any that may have been deleted), and if so, append those values to the set.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: All selected value must be present in the choiceValues array, but value was 2;4 and choiceValues was 4;3</title><link>https://community.appian.com/thread/142235?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2024 17:03:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:43228232-daa4-41d8-879e-282e569362c5</guid><dc:creator>appian.user</dc:creator><description>&lt;p&gt;can you please suggest by coding how can I do it that you&amp;nbsp;mentioned to null it out or show an error validation:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;quot; you can either null it out, or force that value into the dropdown selections and have the dropdown component show an error validation. &amp;quot;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: All selected value must be present in the choiceValues array, but value was 2;4 and choiceValues was 4;3</title><link>https://community.appian.com/thread/142233?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2024 16:56:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e0deacc1-4879-4e5e-b1c9-8aa35876fae7</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;upon initially loading the form, you need to check whether any of the pre-filled dropdown items have a current value that violates the available choices for the dropdown.&amp;nbsp; that&amp;#39;s as simple as checking the local variable that will hold the dropdown choices to see whether it contains the selected value or not.&amp;nbsp; then if the pre-loaded value setting is observed to contain a value not among the valid choices, you can either null it out, or force that value into the dropdown selections and have the dropdown component show an error validation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: All selected value must be present in the choiceValues array, but value was 2;4 and choiceValues was 4;3</title><link>https://community.appian.com/thread/142232?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2024 16:53:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:65e7ee8c-6e36-406f-92d3-1cca179c9704</guid><dc:creator>appian.user</dc:creator><description>&lt;p&gt;can you please elaborate ?&lt;/p&gt;
&lt;p&gt;actually while selecting from dropdown data exist that is why data is visible in dropdown but once user delete the drop down data then when editing this dropdown error throws as that dropdown is deleted&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: All selected value must be present in the choiceValues array, but value was 2;4 and choiceValues was 4;3</title><link>https://community.appian.com/thread/142230?ContentTypeID=1</link><pubDate>Mon, 28 Oct 2024 16:33:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2ac5bfe8-0023-48d8-9113-bbd92df1423d</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;I solve such situations by checking that all the values are contained in the list of choiceValues before assigning them to the field.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>