<?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 save previous selected value of dropdown in local variables?</title><link>https://community.appian.com/discussions/f/general/21142/how-to-save-previous-selected-value-of-dropdown-in-local-variables</link><description>Hi , 
 I am having a drop down with 4 choice values A,B,C,D. Based upon the value selected for Eg; D, a section will appear below. 
 My requirement is 
 
 when the drop down value selected is D, then below section should be refreshed i.e. set the section</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: how to save previous selected value of dropdown in local variables?</title><link>https://community.appian.com/thread/82422?ContentTypeID=1</link><pubDate>Tue, 08 Jun 2021 11:47:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:deef2e90-6c2b-434d-bfd3-a10aae8808b7</guid><dc:creator>pradeepb0001</dc:creator><description>&lt;p&gt;thank u &lt;a href="/members/mikes0011"&gt;Mike Schmitt&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to save previous selected value of dropdown in local variables?</title><link>https://community.appian.com/thread/82406?ContentTypeID=1</link><pubDate>Mon, 07 Jun 2021 14:27:29 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:eddddaf8-8351-4594-8fc7-93c3af5ea4ce</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;The above posted code will work (though i&amp;#39;m unclear what &amp;quot;should be refreshed&amp;quot; really implies from your initial requirement description); however I&amp;#39;d personally recommend simplifying if possible and just using stacked saveIntos to save a single &amp;quot;last value&amp;quot; historical copy whenever the dropdown is changed.&amp;nbsp; You can then (i assume) store your logic for the &amp;quot;refresh&amp;quot; condition in a subsequent local variable, which will refresh anytime either of the earlier values gets changed.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!values: { &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, &amp;quot;C&amp;quot;, &amp;quot;D&amp;quot; },
  local!currentSelection,
  local!oldSelection,

  local!isRefresh: if(
    isnull(local!oldSelection),
    &amp;quot;&amp;quot;,
    &amp;quot;&amp;quot; /* put refresh logic here */
  ),

  {
    a!dropdownField(
      label: &amp;quot;Dropdown&amp;quot;,
      choiceLabels: local!values,
      choiceValues: local!values,
      placeholder: &amp;quot;--select a value--&amp;quot;,
      value: local!currentSelection,
      saveInto: {
        a!save(
          local!oldSelection,
          local!currentSelection
        ),
        a!save(
          local!currentSelection,
          save!value
        )
      }
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to save previous selected value of dropdown in local variables?</title><link>https://community.appian.com/thread/82403?ContentTypeID=1</link><pubDate>Mon, 07 Jun 2021 13:48:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ae2fd4dd-e4b4-4031-8253-cd895bdc4d0b</guid><dc:creator>pradeepb0001</dc:creator><description>&lt;p&gt;thank u &lt;a href="/members/ankitab254"&gt;ankitab254&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to save previous selected value of dropdown in local variables?</title><link>https://community.appian.com/thread/82399?ContentTypeID=1</link><pubDate>Mon, 07 Jun 2021 10:59:11 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b62d3d1d-bfea-4971-a594-69fb9603e55f</guid><dc:creator>ankitab254</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!dropdownValue:{&amp;quot;A&amp;quot;,&amp;quot;B&amp;quot;,&amp;quot;C&amp;quot;,&amp;quot;D&amp;quot;},
  local!selected,
  local!existingSelection,

  local!isSectionRefresh: if(local!selected=&amp;quot;D&amp;quot;, true(),
  if(and(local!selected=&amp;quot;A&amp;quot;,
  index(local!existingSelection,(count(local!existingSelection)-1),&amp;quot;&amp;quot;)=&amp;quot;D&amp;quot;),true(),
  false()
  )
  ),
  
  {
    a!dropdownField(
      label:&amp;quot;Dropdown&amp;quot;,
      choiceLabels: local!dropdownValue,
      choiceValues: local!dropdownValue,
      placeholder: &amp;quot;Please select&amp;quot;,
      value: local!selected,
      saveInto: {
        local!selected,
        a!save(local!existingSelection,
        append(local!existingSelection,local!selected))
      }
    ),
    a!textField(
      label:local!existingSelection,
      value: if(local!isSectionRefresh, null, local!selected)
     
    )
  }
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You can try something similar to this&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>