<?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>a!save() and saveInto()</title><link>https://community.appian.com/discussions/f/general/17376/a-save-and-saveinto</link><description>anybody can explain a!save() and saveInto() some little more depth</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: a!save() and saveInto()</title><link>https://community.appian.com/thread/68416?ContentTypeID=1</link><pubDate>Fri, 26 Jul 2019 13:24:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:be4c5a74-5c62-4912-a3e9-7d55b4f31c34</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;Basically, if you just want to save the value of the component to a variable, you simply type the variable you want in saveInto.&lt;/p&gt;
&lt;p&gt;saveInto: ri!input&lt;/p&gt;
&lt;p&gt;That puts whatever the user chose, typed, selected, etc. into ri!input.&amp;nbsp; Easy.&lt;/p&gt;
&lt;p&gt;If you need to do something more complicated, or additional things, you can use a!save().&amp;nbsp; a!save takes a target, the variable the stuff goes into, and a value, the stuff that goes in there.&amp;nbsp; save!value is a unique variable that you have access to inside that function only, which is whatever the user chose, typed, selected, etc.&lt;/p&gt;
&lt;p&gt;saveInto: a!save(ri!input, save!value) does exactly the same thing as the other code above&lt;/p&gt;
&lt;p&gt;The advantage you get is that you can do all kinds of extra functions on the target, and all kinds of extra functions on the value.&amp;nbsp; You can, for instance, use an if() to determine which of 3 different variables you save into based on conditions; and at the same time enumerate the value, or sum it with something else, or concatenate a timestamp to the end of it, or whatever you want.&amp;nbsp; The possibilities are virtually limitless.&lt;/p&gt;
&lt;p&gt;Another fun thing is that saveInto accepts a list, and it will run the list in order from top to bottom.&amp;nbsp; It&amp;#39;s one of only a couple of places where you&amp;#39;re guaranteed an order of execution.&amp;nbsp; One common practice I see is a list with a target at the top and a bunch of saves.&amp;nbsp; This is what many programmers do when the order doesn&amp;#39;t matter, or when it does and it&amp;#39;s important that&amp;nbsp;the top one be set first.&lt;/p&gt;
&lt;p&gt;saveInto:{&lt;/p&gt;
&lt;p&gt;ri!input,&lt;/p&gt;
&lt;p&gt;a!save(...),&lt;/p&gt;
&lt;p&gt;a!save(...),&lt;/p&gt;
&lt;p&gt;a!save(...)&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: a!save() and saveInto()</title><link>https://community.appian.com/thread/68406?ContentTypeID=1</link><pubDate>Thu, 25 Jul 2019 22:24:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c5c10864-a3b3-4719-b214-3cf22a8a3fde</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;&lt;em&gt;&lt;strong&gt;saveInto&lt;/strong&gt;&lt;/em&gt; is generally a parameter used in user-interactive components that collects an array of save targets to receive the new value entered into that component by a user.&amp;nbsp; It&amp;#39;s not a function hence no &amp;quot;()&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;a!save()&lt;/strong&gt;&lt;/em&gt; is a rule which can be added to within the saveInto list of pretty much any component, allowing incredibly increased functionality by allowing a user to save arbitrary values into arbitrary different variables, including but not limited to a transformed version of the incoming value from the component.&lt;/p&gt;
&lt;p&gt;Here is an example of an &lt;em&gt;a!textField()&lt;/em&gt;&amp;nbsp;component that uses a generic save as well as an a!save() inside its saveInto.&amp;nbsp; I suggest you create a similar interface and play around with it some to really explore how this functionality works.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;load(
  local!textValue: &amp;quot;initial value&amp;quot;,

  local!textUpdated: false(),

  a!textField(
    label: &amp;quot;Test Text&amp;quot;,
    instructions: if(local!textUpdated, &amp;quot;(Updated)&amp;quot;, &amp;quot;&amp;quot;),
    value: local!textValue,
    saveInto: {
      local!textValue,
      a!save(
        local!textUpdated,
        true()
      )
    }
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>