Loops In Appian

Hello Today we will be having a look at Looping Functions Available in Appian WIth their Use cases.

  • a!forEach
  • apply
  • all
  • any
  • filter
  • merge
  • none
  • reduce
  • reject

Let’s Start with All Time Famous

>>a!forEach

Here we are Trying to Find Multiples of 3
a!forEach(items: enumerate(10)+1,expression: fn!product(3,fv!item)),
  • fv!item (Any Type): The current item
  • fv!index (Integer): The current item’s index in the items array
  • fv!identifer (Any Type Array): When items are a DataSubset with identifiers, the current item’s identifier, otherwise null
  • fv!isFirst (Boolean): True for the first item in the items array, otherwise false
  • fv!isLast (Boolean): True for the last item in the items array, otherwise false
  • fv!itemCount (Integer): The total number of items (including nulls)
With Help of Apply we are aslo able to achive the same Output
apply(fn!product,{enumerate(17)+1},3)

>>apply

With Help of Apply we are aslo able to achive the same Output
apply(fn!product,{enumerate(17)+1},3)

When we Try to Compare both Blocks Of Code we can easily Reduce the blocks of Code by Using Appian Given Functions.

>> all

all( a!isNotNullOrEmpty, {1, 2, null, 3, null, 4} )

It will keep Dive and Check for All saving iteration time with an Overall One Result.

>> any()

It can be considered the Opposite of all Function

ex: any( a!isNullOrEmpty, {null, 1, 2, 3, 4, 5} ) It will check if any of the desired Function results exists.

>> filter()

filterpredicate, list, context )

ex : filter(a!isNotNullOrEmpty,{1, 2, null, 3, null, 4})

>> merge

It takes the Number of Lists and merges them into a single list.

Additional info We also have such function for strings named tostring() and for multiple we can make use of touniformstring()

>> none

Note: we have limitations with this function i.e we cannot use a!forEach() with none()

ex : none(a!isNullOrEmpty,{1, 2, null, 3, null, 4})

>> reduce

ex: reduce( fn!substitute, “abcdefg”, {“a”, “d”, “f”}, “#” )

>> reject

ex : reject( a!isNullOrEmpty, {1, 2, null, 3, null, 4} )

These are Looping Functions that Play a vital role in optimizing the code and making fewer iterations.

We Can Also Design Our Custom Loop Using a Process Model in Appian By Handling Counter Variables and Checking conditions using Gateways.

Have a best Day Guys.


Discover more from Appian Tips

Subscribe to get the latest posts sent to your email.

Leave a Reply

Up ↑

Discover more from Appian Tips

Subscribe now to keep reading and get access to the full archive.

Continue reading

Discover more from Appian Tips

Subscribe now to keep reading and get access to the full archive.

Continue reading