Comparing consecutive item values in a Matches variable?

I have a matches variable with 39 items in it called “vSubStringIndexArray”, I want to go through each item as a string and compare consecutive items to see if they are equal (1 to 2, 2 to 3, 3 to 4) in order to on input values that don’t match. I don’t know how to access two items of a Matches as strings and comparte them.

Basically wanting to do this if this sort of thing was possible:
vSubStringIndexArray(1).toString = vSubStringIndexArray(2).toString

Lets say in this instance item 1 houses the value “Cat” and item 2 houses the value of “Dog”

use for each and item as match them item.value give the result of this and for next element

Hope it will work!!!

Cheers @css

Hi @ParasTripathi I’m getting an “object reference not set to an instance of an object” error when using this code below in an if statement inside of a for each ‘item’ in ‘vSubStringIndexArray’ activity:

vSubStringIndexArray(item.index).value = vSubStringIndexArray(item.index+1).value

@css Please share xaml file!!

Sequence.xaml (3.6 KB)

Here is a copy of just that current section I’m working with. ^

This is blank Please share the xaml which gives error @css (605.3 KB)

Here’s the whole zipped, see if this one works on your end.

1 Like

Hi @css
In If Condition:
Use this expression to match the next element of match collection:


This will not give any error and resolve your problem!!
Cheers @css :grinning: :grinning:


This worked great, thanks for taking the time to look at it, much appreciated!



You’re welcome, it has been my pleasure helping you out!
Please feel free to discuss further if any issue rises. :hugs:


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.