<?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>How to access id of selected card in saveInto parameter of card choice field?</title><link>https://community.appian.com/discussions/f/user-interface/30986/how-to-access-id-of-selected-card-in-saveinto-parameter-of-card-choice-field</link><description>I have a parent record with a child record (One to many mapping). In the UI, to select data for child record, we are using card choice field. Multiple selection is allowed. Now, on every selection, I want the relationship inside that parent record rule</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to access id of selected card in saveInto parameter of card choice field?</title><link>https://community.appian.com/thread/123679?ContentTypeID=1</link><pubDate>Thu, 04 Jan 2024 15:13:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:98f77ceb-467b-45ff-8e1c-41368beaca53</guid><dc:creator>tarunt0003</dc:creator><description>&lt;p&gt;Thanks&amp;nbsp;&lt;a href="/members/mikes0011"&gt;Mike Schmitt&lt;/a&gt;&amp;nbsp;. I will try what you suggested. Previously, I tried a!foreach() in place of append(). But, I have one more usecase in it where I need to capture the &amp;quot;Other&amp;quot; value using textbox, which gets enabled only when user selects the card choice with name OTHER. I need to maintain that value as well on the same index where id for OTHER is stored. And looping approach was overriding values with new values. So, as a consequence I was losing the value in the record field corresponding to that text box.&lt;/p&gt;
&lt;p&gt;But, I will try with a new dynamic local variable and update you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to access id of selected card in saveInto parameter of card choice field?</title><link>https://community.appian.com/thread/123545?ContentTypeID=1</link><pubDate>Mon, 01 Jan 2024 17:03:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d12b1af1-0065-4b96-903a-4ee520b39b3e</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;you&amp;#39;ll probably just need to find a way to simplify your save operation to avoid using this, which probably gets tripped up when the user clicks too fast...&lt;/p&gt;
&lt;p&gt;&amp;quot;save!value[length(save!value)],&amp;quot;&lt;/p&gt;
&lt;p&gt;Instead of constructing every member of the added record in the saveInto, try declaring a dynamic local variable that iterates over the list of local!selectedWeather (which would be a basic list that items get added to when clicked), and it sets up an entry for every current item in that list.&amp;nbsp; This approach should(?) be a bit mroe resistant against users spam-clicking items, since it&amp;#39;ll always adjust to the total values in local!selectedWeather after the user stops clicking stuff.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to access id of selected card in saveInto parameter of card choice field?</title><link>https://community.appian.com/thread/123533?ContentTypeID=1</link><pubDate>Sun, 31 Dec 2023 12:00:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e5939b7d-765e-4699-b4d1-771ed3423811</guid><dc:creator>tarunt0003</dc:creator><description>&lt;p&gt;&lt;a href="/members/mikes0011"&gt;Mike Schmitt&lt;/a&gt;&amp;nbsp;I am facing a weird issue in QA test after implementing the solution to main problem stated in this thread. Problem is when I am slowly selecting the multiple card choices one after other, then all values in the relationship are updating perfectly fine.&lt;/p&gt;
&lt;p&gt;But, in any case, if my speed of selection of card choices is high, then it persists only last selected card choice. I&amp;#39;ve hit the wall but not able to find out what&amp;#39;s the issue here.&lt;/p&gt;
&lt;p&gt;Attached is the full code I implemented so far. Record references may need to be replaced with local dummy data to test.&lt;/p&gt;
&lt;p&gt;This is urgent, any help is really appreciated.&lt;br /&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!allWeather: rule!IMS_QR_getWeather(id: null),
  local!selectedWeather,
  {
    a!cardChoiceField(
      label: &amp;quot;Weather Choices&amp;quot;,
      labelPosition: &amp;quot;COLLAPSED&amp;quot;,
      data: &amp;#39;recordType!{0d9629bd-6e75-4c05-94e2-edfb817cb378}IMS Ref Weather&amp;#39;,
      cardTemplate: a!cardTemplateBarTextStacked(
        id: fv!data[&amp;#39;recordType!{0d9629bd-6e75-4c05-94e2-edfb817cb378}IMS Ref Weather.fields.{5a76435e-3c34-4bfc-9d4a-639d0639076a}id&amp;#39;],
        primaryText: fv!data[&amp;#39;recordType!{0d9629bd-6e75-4c05-94e2-edfb817cb378}IMS Ref Weather.fields.{6264f67e-0086-4b15-a25c-b738d8a2aac1}labelEn&amp;#39;],
        /* To be replaced by translation set */
        icon: fv!data[&amp;#39;recordType!{0d9629bd-6e75-4c05-94e2-edfb817cb378}IMS Ref Weather.fields.{513cbb34-3b72-4a09-a21e-adba417682bb}icon&amp;#39;]
      ),
      value: if(
        ri!readOnly,
        ri!mandatoryIncident[&amp;#39;recordType!{b1f5fef5-db37-4e8e-826d-7f8c578856be}IMS Mandatory Incident Report.relationships.{5e822525-b6fe-4b47-b78b-fe13ceb92462}incidentWeatherConditionMapping.fields.{1b4c7204-a0a3-4ac3-8a5b-044117440ce9}weather&amp;#39;],
        local!selectedWeather
      ),
      saveInto: {
        a!save(local!selectedWeather, save!value),
        a!save(
          ri!mandatoryIncident[&amp;#39;recordType!{b1f5fef5-db37-4e8e-826d-7f8c578856be}IMS Mandatory Incident Report.relationships.{5e822525-b6fe-4b47-b78b-fe13ceb92462}incidentWeatherConditionMapping&amp;#39;],
          append(
            ri!mandatoryIncident[&amp;#39;recordType!{b1f5fef5-db37-4e8e-826d-7f8c578856be}IMS Mandatory Incident Report.relationships.{5e822525-b6fe-4b47-b78b-fe13ceb92462}incidentWeatherConditionMapping&amp;#39;],
            &amp;#39;recordType!{c899c492-a6b1-4ba3-9e4d-30951e696e25}IMS Weather Condition&amp;#39;(
              &amp;#39;recordType!{c899c492-a6b1-4ba3-9e4d-30951e696e25}IMS Weather Condition.fields.{1b4c7204-a0a3-4ac3-8a5b-044117440ce9}weather&amp;#39;: save!value[length(save!value)],
              &amp;#39;recordType!{c899c492-a6b1-4ba3-9e4d-30951e696e25}IMS Weather Condition.fields.{087f6896-59d4-4647-81fc-b30697f987b8}incidentReportId&amp;#39;: null,
              &amp;#39;recordType!{c899c492-a6b1-4ba3-9e4d-30951e696e25}IMS Weather Condition.fields.{8300cc97-8931-4a46-a3ba-b533c0f28a7d}createdBy&amp;#39;: loggedInUser(),
              &amp;#39;recordType!{c899c492-a6b1-4ba3-9e4d-30951e696e25}IMS Weather Condition.fields.{35ec86a4-aef0-452b-85e1-6fe17d03b2e4}createdOn&amp;#39;: now(),
              &amp;#39;recordType!{c899c492-a6b1-4ba3-9e4d-30951e696e25}IMS Weather Condition.fields.{c4faca89-e4bf-4ffb-a794-5147471aeb08}modifiedBy&amp;#39;: loggedInUser(),
              &amp;#39;recordType!{c899c492-a6b1-4ba3-9e4d-30951e696e25}IMS Weather Condition.fields.{8aa5315a-c9a4-405f-b45c-bd2f34909274}modifiedOn&amp;#39;: now()
            )
          )
        )
      },
      align: &amp;quot;START&amp;quot;,
      showShadow: false,
      validations: {},
      required: true,
      disabled: ri!readOnly
    ),
    a!localVariables(
      local!otherIndex: if(
        a!isNotNullOrEmpty(
          ri!mandatoryIncident[&amp;#39;recordType!{b1f5fef5-db37-4e8e-826d-7f8c578856be}IMS Mandatory Incident Report.relationships.{5e822525-b6fe-4b47-b78b-fe13ceb92462}incidentWeatherConditionMapping.fields.{1b4c7204-a0a3-4ac3-8a5b-044117440ce9}weather&amp;#39;]
        ),
        wherecontains(
          tointeger(
            rule!IMS_RULE_General_indexWhere(
              initialArray: local!allWeather[&amp;#39;recordType!{0d9629bd-6e75-4c05-94e2-edfb817cb378}IMS Ref Weather.fields.{6264f67e-0086-4b15-a25c-b738d8a2aac1}labelEn&amp;#39;],
              finalArray: local!allWeather[&amp;#39;recordType!{0d9629bd-6e75-4c05-94e2-edfb817cb378}IMS Ref Weather.fields.{5a76435e-3c34-4bfc-9d4a-639d0639076a}id&amp;#39;],
              value: &amp;quot;Other&amp;quot;
            )
          ),
          ri!mandatoryIncident[&amp;#39;recordType!{b1f5fef5-db37-4e8e-826d-7f8c578856be}IMS Mandatory Incident Report.relationships.{5e822525-b6fe-4b47-b78b-fe13ceb92462}incidentWeatherConditionMapping.fields.{1b4c7204-a0a3-4ac3-8a5b-044117440ce9}weather&amp;#39;]
        ),
        {}
      ),
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              a!textField(
                label: &amp;quot;Weather Condition (Other)&amp;quot;,
                labelPosition: &amp;quot;ABOVE&amp;quot;,
                value: ri!mandatoryIncident[&amp;#39;recordType!{b1f5fef5-db37-4e8e-826d-7f8c578856be}IMS Mandatory Incident Report.relationships.{5e822525-b6fe-4b47-b78b-fe13ceb92462}incidentWeatherConditionMapping&amp;#39;][local!otherIndex][&amp;#39;recordType!{c899c492-a6b1-4ba3-9e4d-30951e696e25}IMS Weather Condition.fields.{7a41d798-0f2e-4ed4-990f-3ad18df6bc04}otherWeather&amp;#39;],
                saveInto: ri!mandatoryIncident[&amp;#39;recordType!{b1f5fef5-db37-4e8e-826d-7f8c578856be}IMS Mandatory Incident Report.relationships.{5e822525-b6fe-4b47-b78b-fe13ceb92462}incidentWeatherConditionMapping&amp;#39;][local!otherIndex][&amp;#39;recordType!{c899c492-a6b1-4ba3-9e4d-30951e696e25}IMS Weather Condition.fields.{7a41d798-0f2e-4ed4-990f-3ad18df6bc04}otherWeather&amp;#39;],
                disabled: ri!readOnly
              )
            },
            width: &amp;quot;MEDIUM&amp;quot;
          ),
          a!columnLayout()
        },
        showWhen: length(local!otherIndex) &amp;gt; 0
      )
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to access id of selected card in saveInto parameter of card choice field?</title><link>https://community.appian.com/thread/123421?ContentTypeID=1</link><pubDate>Tue, 26 Dec 2023 16:18:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6e0d7917-70d3-474b-a2f2-ace456e0685c</guid><dc:creator>tarunt0003</dc:creator><description>&lt;p&gt;Thanks&amp;nbsp;&lt;a href="/members/mikes0011"&gt;Mike Schmitt&lt;/a&gt;&amp;nbsp;for notifying. I have reported as spam.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to access id of selected card in saveInto parameter of card choice field?</title><link>https://community.appian.com/thread/123420?ContentTypeID=1</link><pubDate>Tue, 26 Dec 2023 15:48:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:403ed673-da15-43f3-9f3b-c0aa36691007</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;SEO spammer.&amp;nbsp; Mark as abusive and move on.&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="/resized-image/__size/640x480/__key/communityserver-discussions-components-files/13/pastedimage1703605729478v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to access id of selected card in saveInto parameter of card choice field?</title><link>https://community.appian.com/thread/123398?ContentTypeID=1</link><pubDate>Mon, 25 Dec 2023 10:59:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:20805fa5-472e-40bd-9b76-9df94a32864e</guid><dc:creator>tarunt0003</dc:creator><description>&lt;p&gt;&lt;a href="/members/adams9753"&gt;adams9753&lt;/a&gt;&amp;nbsp;I tried something similar and it&amp;#39;s working fine. Thanks&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!cardLayout(
  contents: {
    a!localVariables(
      local!allWeather: rule!IMS_QR_getWeather(id: null),
      local!otherWeather,
      local!selectedWeather,
      {
        a!cardChoiceField(
          label: &amp;quot;Weather Choices&amp;quot;,
          labelPosition: &amp;quot;COLLAPSED&amp;quot;,
          data: &amp;#39;recordType!{0d9629bd-6e75-4c05-94e2-edfb817cb378}IMS Ref Weather&amp;#39;,
          cardTemplate: a!cardTemplateBarTextStacked(
            id: fv!data[&amp;#39;recordType!{0d9629bd-6e75-4c05-94e2-edfb817cb378}IMS Ref Weather.fields.{5a76435e-3c34-4bfc-9d4a-639d0639076a}id&amp;#39;],
            primaryText: fv!data[&amp;#39;recordType!{0d9629bd-6e75-4c05-94e2-edfb817cb378}IMS Ref Weather.fields.{6264f67e-0086-4b15-a25c-b738d8a2aac1}labelEn&amp;#39;],
            /* To be replaced by translation set */
            icon: fv!data[&amp;#39;recordType!{0d9629bd-6e75-4c05-94e2-edfb817cb378}IMS Ref Weather.fields.{513cbb34-3b72-4a09-a21e-adba417682bb}icon&amp;#39;]
          ),
          value: local!selectedWeather,
          saveInto: {
            local!selectedWeather,
            a!save(
              ri!mandatoryIncident[&amp;#39;recordType!{b1f5fef5-db37-4e8e-826d-7f8c578856be}IMS Mandatory Incident Report.relationships.{5e822525-b6fe-4b47-b78b-fe13ceb92462}incidentWeatherConditionMapping&amp;#39;],
              append(
                ri!mandatoryIncident[&amp;#39;recordType!{b1f5fef5-db37-4e8e-826d-7f8c578856be}IMS Mandatory Incident Report.relationships.{5e822525-b6fe-4b47-b78b-fe13ceb92462}incidentWeatherConditionMapping&amp;#39;],
                &amp;#39;recordType!{c899c492-a6b1-4ba3-9e4d-30951e696e25}IMS Weather Condition&amp;#39;(
                  &amp;#39;recordType!{c899c492-a6b1-4ba3-9e4d-30951e696e25}IMS Weather Condition.fields.{1b4c7204-a0a3-4ac3-8a5b-044117440ce9}weather&amp;#39;: save!value[length(save!value)],
                  &amp;#39;recordType!{c899c492-a6b1-4ba3-9e4d-30951e696e25}IMS Weather Condition.fields.{087f6896-59d4-4647-81fc-b30697f987b8}incidentReportId&amp;#39;: null,
                  &amp;#39;recordType!{c899c492-a6b1-4ba3-9e4d-30951e696e25}IMS Weather Condition.fields.{8300cc97-8931-4a46-a3ba-b533c0f28a7d}createdBy&amp;#39;: loggedInUser(),
                  &amp;#39;recordType!{c899c492-a6b1-4ba3-9e4d-30951e696e25}IMS Weather Condition.fields.{35ec86a4-aef0-452b-85e1-6fe17d03b2e4}createdOn&amp;#39;: now(),
                  &amp;#39;recordType!{c899c492-a6b1-4ba3-9e4d-30951e696e25}IMS Weather Condition.fields.{c4faca89-e4bf-4ffb-a794-5147471aeb08}modifiedBy&amp;#39;: loggedInUser(),
                  &amp;#39;recordType!{c899c492-a6b1-4ba3-9e4d-30951e696e25}IMS Weather Condition.fields.{8aa5315a-c9a4-405f-b45c-bd2f34909274}modifiedOn&amp;#39;: now()
                )
              )
            )
          },
          align: &amp;quot;START&amp;quot;,
          showShadow: false,
          validations: {}
        ),
        a!localVariables(
          local!otherIndex: if(
            a!isNotNullOrEmpty(
              ri!mandatoryIncident[&amp;#39;recordType!{b1f5fef5-db37-4e8e-826d-7f8c578856be}IMS Mandatory Incident Report.relationships.{5e822525-b6fe-4b47-b78b-fe13ceb92462}incidentWeatherConditionMapping.fields.{1b4c7204-a0a3-4ac3-8a5b-044117440ce9}weather&amp;#39;]
            ),
            wherecontains(
              tointeger(
                rule!IMS_RULE_General_indexWhere(
                  initialArray: local!allWeather[&amp;#39;recordType!{0d9629bd-6e75-4c05-94e2-edfb817cb378}IMS Ref Weather.fields.{6264f67e-0086-4b15-a25c-b738d8a2aac1}labelEn&amp;#39;],
                  finalArray: local!allWeather[&amp;#39;recordType!{0d9629bd-6e75-4c05-94e2-edfb817cb378}IMS Ref Weather.fields.{5a76435e-3c34-4bfc-9d4a-639d0639076a}id&amp;#39;],
                  value: &amp;quot;Other&amp;quot;
                )
              ),
              ri!mandatoryIncident[&amp;#39;recordType!{b1f5fef5-db37-4e8e-826d-7f8c578856be}IMS Mandatory Incident Report.relationships.{5e822525-b6fe-4b47-b78b-fe13ceb92462}incidentWeatherConditionMapping.fields.{1b4c7204-a0a3-4ac3-8a5b-044117440ce9}weather&amp;#39;]
            ),
            {}
          ),
          a!columnsLayout(
            columns: {
              a!columnLayout(
                contents: {
                  a!textField(
                    label: &amp;quot;Weather Condition (Other)&amp;quot;,
                    labelPosition: &amp;quot;ABOVE&amp;quot;,
                    value: local!otherWeather,
                    saveInto: {
                      local!otherWeather,
                      a!save(
                        ri!mandatoryIncident[&amp;#39;recordType!{b1f5fef5-db37-4e8e-826d-7f8c578856be}IMS Mandatory Incident Report.relationships.{5e822525-b6fe-4b47-b78b-fe13ceb92462}incidentWeatherConditionMapping&amp;#39;][local!otherIndex][&amp;#39;recordType!{c899c492-a6b1-4ba3-9e4d-30951e696e25}IMS Weather Condition.fields.{7a41d798-0f2e-4ed4-990f-3ad18df6bc04}otherWeather&amp;#39;],
                        save!value
                      )
                    }
                  )
                },
                width: &amp;quot;MEDIUM&amp;quot;
              ),
              a!columnLayout()
            },
            showWhen: length(local!otherIndex) &amp;gt; 0
          )
        )
      }
    )
  },
  showWhen: ri!currentFormStep = 2,
  showBorder: false
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to access id of selected card in saveInto parameter of card choice field?</title><link>https://community.appian.com/thread/123396?ContentTypeID=1</link><pubDate>Mon, 25 Dec 2023 10:34:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2779bf61-b8d6-483a-9823-01b5b16ece8f</guid><dc:creator>adams9753</dc:creator><description>&lt;p&gt;Well...The approach to building the rule involves using the saveInto parameter of the a!cardChoiceField function. This parameter allows you to specify the target variable where you want to save the selected value from the card choice field.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to access id of selected card in saveInto parameter of card choice field?</title><link>https://community.appian.com/thread/123394?ContentTypeID=1</link><pubDate>Mon, 25 Dec 2023 07:44:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d8132dfe-faf0-42cb-8f79-f5f3989f04aa</guid><dc:creator>tarunt0003</dc:creator><description>&lt;p&gt;&lt;a href="/members/adams9753"&gt;adams9753&lt;/a&gt;&amp;nbsp;Can you please explain the approach to build that rule?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to access id of selected card in saveInto parameter of card choice field?</title><link>https://community.appian.com/thread/123393?ContentTypeID=1</link><pubDate>Mon, 25 Dec 2023 07:40:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:11c7eb92-cda6-484a-87ab-4afbd58d9645</guid><dc:creator>adams9753</dc:creator><description>[deleted]&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>