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's the way to get batches of array in particular set.
e.g. [123],[456],[789],[10,11]
thanks,
Tushar
Discussion posts and replies are publicly visible
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. You might be able to use it to some effect for your use case, after a bit of tweaking.
with( local!chunkSize: 3, /* configurable */ local!startingList: { "a", "b", "c", "d", "e", "f", "g", "h" }, 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() ) ) ) ) )
try this
fn!sort( union( {1,2},{3,4},{5,6} ) )
For what it'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. Besides, if the elements are already relatively in order when passed into union(), they'll stay in that same order in the resulting array.
Also, this thread was from 2 years ago, so hopefully this user isn't still in 17.2 ...