<?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>I want to iterate a!save() expression 10 times</title><link>https://community.appian.com/discussions/f/new-to-appian/33894/i-want-to-iterate-a-save-expression-10-times</link><description>I want to iterate a a!save() expression for 10 (n times) when I press a button</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: I want to iterate a!save() expression 10 times</title><link>https://community.appian.com/thread/128814?ContentTypeID=1</link><pubDate>Fri, 02 Feb 2024 17:17:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:da1525e3-58ce-4ff0-9110-eb420e6a24e2</guid><dc:creator>Abhay Dalsaniya</dc:creator><description>&lt;p&gt;There is a need of a function which sorts elements of an array. I think such function does not exist today.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I want to iterate a!save() expression 10 times</title><link>https://community.appian.com/thread/128545?ContentTypeID=1</link><pubDate>Wed, 31 Jan 2024 09:53:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:47568e14-67f7-4a69-8caa-55e1fb01b82d</guid><dc:creator>Konduru Chaitanya</dc:creator><description>&lt;p&gt;Harshit Has given the answer above for your requirement.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I want to iterate a!save() expression 10 times</title><link>https://community.appian.com/thread/128544?ContentTypeID=1</link><pubDate>Wed, 31 Jan 2024 09:49:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:17523abf-dec8-4c59-8a05-89fd9dcb8701</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;This has been discussed on community quite a lot of times now -&amp;nbsp;&lt;a href="https://community.appian.com/discussions/f/general/31178/function"&gt;community.appian.com/.../function&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if(
  a!isNullOrEmpty(ri!inputArray),
  {},
  a!localVariables(
    local!data: a!forEach(
      items: ri!inputArray,
      expression: { value: fv!item }
    ),
    todatasubset(
      local!data,
      a!pagingInfo(
        startIndex: 1,
        batchSize: - 1,
        sort: a!sortInfo(
          field: &amp;quot;value&amp;quot;,
          ascending: or(ri!ascending)
        )
      )
    ).data.value
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I want to iterate a!save() expression 10 times</title><link>https://community.appian.com/thread/128543?ContentTypeID=1</link><pubDate>Wed, 31 Jan 2024 09:44:22 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e92026f2-33e0-4813-8aa3-34e04059cd68</guid><dc:creator>vijayp6380</dc:creator><description>&lt;p&gt;&lt;span&gt;I want to sort a numbers array in Appian without using sort function&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I want to iterate a!save() expression 10 times</title><link>https://community.appian.com/thread/128542?ContentTypeID=1</link><pubDate>Wed, 31 Jan 2024 09:43:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d46adc68-9d9b-4062-b217-7f6acf9b3f34</guid><dc:creator>vijayp6380</dc:creator><description>&lt;p&gt;I want to sort a number array in Appian without using sort function&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I want to iterate a!save() expression 10 times</title><link>https://community.appian.com/thread/128541?ContentTypeID=1</link><pubDate>Wed, 31 Jan 2024 09:07:04 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4b0ebfa1-7d7c-449e-928f-c83983862b8a</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;&lt;a href="/members/vijayp6380"&gt;vijayp6380&lt;/a&gt;&amp;nbsp;You shouldn&amp;#39;t be doing that unless you are sure that there is no better way to do what you are trying to achieve.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For example, the above code doesn&amp;#39;t need a&amp;nbsp;forEach loop&amp;nbsp;if you just want to update the items of an array. It can be simplified as&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!save(
    local!X,
    enumerate(10)+1
  )&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;But if you have a particular requirement which cannot be solved without a loop, then you have the code from Venky.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I want to iterate a!save() expression 10 times</title><link>https://community.appian.com/thread/128539?ContentTypeID=1</link><pubDate>Wed, 31 Jan 2024 09:01:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d5d88ff2-256d-4821-9049-397ac7e7d6c1</guid><dc:creator>Konduru Chaitanya</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;a href="/members/vijayp6380"&gt;vijayp6380&lt;/a&gt;&amp;nbsp;&lt;br /&gt;You will have to use a!forEach() and run your a!save()(Not recommended). Also do you have any particular variable that defines the number of iterations that has to be performed?&amp;nbsp;&lt;br /&gt;What will this a!save() perform exactly?&lt;br /&gt; If the Rule Input or Local variable that you are going to use for the target is same, You don&amp;#39;t need to do the loop. May be a better explanation of your requirement would help all of us to give a better solution.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I want to iterate a!save() expression 10 times</title><link>https://community.appian.com/thread/128537?ContentTypeID=1</link><pubDate>Wed, 31 Jan 2024 08:57:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3a1edc7d-5d61-47e6-be01-558020959611</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;A foreach would do that. But what do you want to achieve?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I want to iterate a!save() expression 10 times</title><link>https://community.appian.com/thread/128536?ContentTypeID=1</link><pubDate>Wed, 31 Jan 2024 08:56:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:378cdb7c-829f-44d3-955a-f8898e6a1a63</guid><dc:creator>venkatrea696188</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!X,
  {
  a!buttonArrayLayout(
    buttons: {
      a!buttonWidget(
        label: &amp;quot;Button&amp;quot;,
        style: &amp;quot;OUTLINE&amp;quot;,
        saveInto: a!forEach(
          items: enumerate(10)+1,
          expression: a!save(
            local!X[fv!index],fv!item
          )
        )
      )
    },
    align: &amp;quot;START&amp;quot;,
    marginBelow: &amp;quot;NONE&amp;quot;
  )
})&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;What do you want to save using a!save() ?&amp;nbsp; Can you provide us with more details&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>