<?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 get particular elements of array</title><link>https://community.appian.com/discussions/f/general/13623/how-to-get-particular-elements-of-array</link><description>Hello, 
 
 I have a array of integer [1,2,3,4,5,6,7,8,9,10,11] is there any function which will give me elements of array if I pass index. 
 or what&amp;#39;s the way to get batches of array in particular set. 
 e.g. [123],[456],[789],[10,11] 
 
 thanks, 
 T</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to get particular elements of array</title><link>https://community.appian.com/thread/76439?ContentTypeID=1</link><pubDate>Sun, 13 Sep 2020 14:48:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dd098e93-36d0-4317-9e04-0fa0ecf2d6c1</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;For what it&amp;#39;s worth, sort() is an unlisted function, and therefore not officially supported by Appian and not guaranteed to always be available or to work in a consistent way.&amp;nbsp; Besides, if the elements are already relatively in order when passed into union(), they&amp;#39;ll stay in that same order in the resulting array.&lt;/p&gt;
&lt;p&gt;Also, this thread was from 2 years ago, so hopefully this user isn&amp;#39;t still in 17.2 ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get particular elements of array</title><link>https://community.appian.com/thread/76438?ContentTypeID=1</link><pubDate>Sun, 13 Sep 2020 14:16:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4f7eeace-e206-4597-af48-80223cafe389</guid><dc:creator>Arunachalam</dc:creator><description>&lt;p&gt;try this&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;fn!sort(&lt;br /&gt; union(&lt;br /&gt; {1,2},{3,4},{5,6}&lt;br /&gt; )&lt;br /&gt; )&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get particular elements of array</title><link>https://community.appian.com/thread/61866?ContentTypeID=1</link><pubDate>Wed, 24 Oct 2018 00:06:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:253ffb47-6155-4fb8-9d29-0de264776f68</guid><dc:creator>tushark171</dc:creator><description>we are on 17.2 version this does not have flatten()&lt;br /&gt;
&lt;br /&gt;
thanks,&lt;br /&gt;
Tushar&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get particular elements of array</title><link>https://community.appian.com/thread/61862?ContentTypeID=1</link><pubDate>Tue, 23 Oct 2018 22:17:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ec714faa-a266-4654-9a20-aca7b8be1dd4</guid><dc:creator>Mike Schmitt</dc:creator><description>have you tried a!flatten()?  it takes {{1,2},{3,4},{5,6}} and turns it into {1,2,3,4,5,6}.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get particular elements of array</title><link>https://community.appian.com/thread/61860?ContentTypeID=1</link><pubDate>Tue, 23 Oct 2018 22:06:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7613721f-eef4-4549-bdf0-c7ca1291cc8c</guid><dc:creator>tushark171</dc:creator><description>Hi Mike,&lt;br /&gt;
&lt;br /&gt;
is there any way I can achieve below scenario:&lt;br /&gt;
&lt;br /&gt;
I have array a:  {{1,2}{3,4}{5,6}}&lt;br /&gt;
    Expected: b: {1,2,3,4,5,6}    &lt;br /&gt;
&lt;br /&gt;
in actual scenario 1,2,3 etc are cdt objects. &lt;br /&gt;
it works if I do append(a[1],a[2],a[3])&lt;br /&gt;
how can I do it dynamically.&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
Tushar&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get particular elements of array</title><link>https://community.appian.com/thread/61859?ContentTypeID=1</link><pubDate>Tue, 23 Oct 2018 20:41:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:41a8838e-0483-482e-b496-1ead124e1d7c</guid><dc:creator>tushark171</dc:creator><description>Thanks Mike,&lt;br /&gt;
&lt;br /&gt;
I did able to call REST webservice in batch within rule using your suggestion of enumerate.&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
Tushar&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get particular elements of array</title><link>https://community.appian.com/thread/61858?ContentTypeID=1</link><pubDate>Tue, 23 Oct 2018 20:33:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7a1e8df3-7fe9-40ac-9baa-2b9f446d228c</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Additionally - I was just able to whip up the following which breaks up any given input array into sub-array chunks of any given size.&amp;nbsp; You might be able to use it to some effect for your use case, after a bit of tweaking.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;with(
  local!chunkSize: 3, /* configurable */
  
  local!startingList: {
    &amp;quot;a&amp;quot;, &amp;quot;b&amp;quot;, &amp;quot;c&amp;quot;, &amp;quot;d&amp;quot;, &amp;quot;e&amp;quot;, &amp;quot;f&amp;quot;, &amp;quot;g&amp;quot;, &amp;quot;h&amp;quot;
  },
  
  local!wholeListSize: rule!APN_arrayLength(local!startingList),
  local!numChunks: ceiling(local!wholeListSize / local!chunkSize),
  
  a!forEach(
    enumerate(local!numChunks),
    
    with(
      local!currentStartIndex: fv!item * local!chunkSize + 1, /* note: this utilizes zero-index of fv!item */
      local!currentIndices: enumerate(local!chunkSize) + local!currentStartIndex,
      
      rule!GLBL_removeBlankArrayMembers( /* this rule just unions the input array with itself */
        index(
          local!startingList,
          local!currentIndices,
          null()
        )
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get particular elements of array</title><link>https://community.appian.com/thread/61850?ContentTypeID=1</link><pubDate>Tue, 23 Oct 2018 16:10:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b96dae07-118b-467a-8c92-31116d63457b</guid><dc:creator>Mike Schmitt</dc:creator><description>If you&amp;#39;re careful, you can use the enumerate function similar to how I used it above, but in such a way that it will give you different ranges from different starting indexes.  But I&amp;#39;d mainly suggest the process model implementation as I&amp;#39;m not sure how easily you&amp;#39;ll be able to handle webservice calls all within a looping expression.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get particular elements of array</title><link>https://community.appian.com/thread/61849?ContentTypeID=1</link><pubDate>Tue, 23 Oct 2018 15:27:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8b696c14-8ade-4e32-abdb-3b8e1e2f2bac</guid><dc:creator>viveku3486</dc:creator><description>Hi Tushar,&lt;br /&gt;
&lt;br /&gt;
As far as i know there is no such function available in appian. However, you can put in your own logic to batch the array elements into different set. One good way is to use   logic he mentioned above&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get particular elements of array</title><link>https://community.appian.com/thread/61848?ContentTypeID=1</link><pubDate>Tue, 23 Oct 2018 15:19:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:92adc83b-b818-4fad-afdb-56cb74a8ef87</guid><dc:creator>tushark171</dc:creator><description>Thanks Mike.&lt;br /&gt;
&lt;br /&gt;
I was searching for any function like sublist in java where we can pass from and to index.&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
Tushar&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get particular elements of array</title><link>https://community.appian.com/thread/61846?ContentTypeID=1</link><pubDate>Tue, 23 Oct 2018 15:03:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8404a205-982a-44d4-aa42-af65e72f40f0</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;You will probably find it easiest to use a looping process model, where each time a loop finishes, you remove the members of the array that you&amp;#39;ve already processed.&lt;br /&gt; &lt;br /&gt; Each time a loop begins you can get the first X number of indices from the current array pretty easily - if it&amp;#39;s 100, you would do:&lt;/p&gt;
&lt;pre&gt;index(&lt;br /&gt;  pv!array,&lt;br /&gt;  enumerate(100)+1,&lt;br /&gt;  {}&lt;br /&gt;)&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get particular elements of array</title><link>https://community.appian.com/thread/61845?ContentTypeID=1</link><pubDate>Tue, 23 Oct 2018 14:59:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c2fcce1d-bcd1-4239-b982-9e1149cac205</guid><dc:creator>tushark171</dc:creator><description>Hi Mike,&lt;br /&gt;
&lt;br /&gt;
Below is the use case:&lt;br /&gt;
&lt;br /&gt;
   I have 10K ids in an array, which I have pass as a input to REST webservice. But when I pass all of those single time the response is more than 5MB and appian is not able to parse it.&lt;br /&gt;
  In this case I&amp;#39;m trying to call the REST webservice in batches of 1000 ids at a time and append the response of webservice. In this case what is the best way to batch the input array 10k ids&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
Tushar&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get particular elements of array</title><link>https://community.appian.com/thread/61843?ContentTypeID=1</link><pubDate>Tue, 23 Oct 2018 14:50:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ff410950-8df9-4cdc-b683-c6a1767e9bbf</guid><dc:creator>Mike Schmitt</dc:creator><description>I&amp;#39;m unclear what your actual use case is - can you provide some further detail/clarification as to what you&amp;#39;re trying to accomplish with this?&lt;br /&gt;
&lt;br /&gt;
And just in case it was unclear from the documentation, index() accepts a single index OR multiple indices in the form of an array, so combined with other set functions available it should be pretty powerful for you.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get particular elements of array</title><link>https://community.appian.com/thread/61842?ContentTypeID=1</link><pubDate>Tue, 23 Oct 2018 14:47:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1fe49399-f6d2-4a13-a5aa-2827c30a861d</guid><dc:creator>tushark171</dc:creator><description>for index function we have to provide every index and not start and end index. in actual case I&amp;#39;ll be having array of 10k - 20k elements and I have to batch it 500 elements each so I don&amp;#39;t think that will be optimal solution.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get particular elements of array</title><link>https://community.appian.com/thread/61841?ContentTypeID=1</link><pubDate>Tue, 23 Oct 2018 14:37:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ac2d8943-91e7-47d4-b178-5523d4a90c89</guid><dc:creator>santhosh Kumar</dc:creator><description>You can use index() function.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get particular elements of array</title><link>https://community.appian.com/thread/61840?ContentTypeID=1</link><pubDate>Tue, 23 Oct 2018 14:34:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a045e186-8e78-4d66-b387-cf51be863033</guid><dc:creator>Mike Schmitt</dc:creator><description>You might be interested in the index() function.&lt;br /&gt;
&lt;a href="https://docs.appian.com/suite/help/18.3/fnc_array_index.html"&gt;docs.appian.com/.../fnc_array_index.html&lt;/a&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>