Use a loop to go through each item in your collection. In this example Task.fruit is the string collection. Name the index variable anything you like. The maximum loop count tells the loop when to stop, in your case you want the number of items in your list, so use the expression Count(Task.fruit) which will be 4. Normally people want to go through the list from the start, so inside the loop you would use Task.fruit[Task.index]. You know collection indices start at 0 right? So
0=Apple
1=Pear
2=Banana
3=Banana
In your case you want to go through it backwards, so instead of Task.fruit[Task.index] you want to look at Task.fruit[Count(Task.fruit)-1-Task.index].
When Task.index=0, you will look at the item with index 4-1-0 = 3 and get Banana
When Task.index=1, you will look at the item with index 4-1-1 = 2 and get Banana
When Task.index=2, you will look at the item with index 4-1-2 = 1 and get Pear
When Task.index=3, you will look at the item with index 4-1-3 = 0 and get Apple

FYI there's a much simpler way of counting how many items are not Banana in your collection. You could just evaluate this expression, no looping necessary.
Count(Task.fruit)-Count(Find(Task.fruit, "Banana"))
Find returns a collection of indices for which the item exists in the given collection (in your case you would get a collection with the values 2 & 3). The count of that is 2, and subtracting it from the total count for the collection gets 2.
------------------------------
Melissa Bailey
Genesys - Employees
------------------------------
Original Message:
Sent: 01-25-2022 06:00
From: Mo Ford
Subject: Count in Reverse Order
Hello,
Is there a way in Architect to COUNT in reverse? For example, if I have an array of {Apple, Pear, Banana, Banana} and I want to use the COUNT function but start from the right, excluding anything Banana, how would I go about that? I considered using the REVERSE function but do not want to reverse the actual words, just the order I'm counting them in.
Regards,
Mo
#ArchitectureandDesign
#Routing(ACD/IVR)
------------------------------
Mo Ford
Upgrade
------------------------------