Compare Two String Lists on its common items

Hi all,

i have 2 list of string type.

data is coming to these list from different source.

List 1 ={“27”,“5678”,“574”}
List 2 = {“574”,“27”,“5678”}

i want to compare these two list having string value in which we have numeric value.

occurces don/t matter as the list have that element
i tried but its not working
tried with 2 for each
attching the xaml (13.9 KB)

@Abhinavpandey So you want to Check if the items in list are Numeric or Not ?

@supermanPunch , i already know the item will be numeric
i am passing data in that list from two different process
but sometimes there is a possibility that items value in list 1 is different to item value in list 2. we need to compare this

@Abhinavpandey So you want to Check if All items of List 1 are present in List 2 or not and also all items in List 2 are present in List 1 or not, Is that right ?

yes @supermanPunch

can be done e.g within an if else
Condition: List1.Except(List2).Count = 0 And List2.Except(List1).Count = 0
true: all List2 items Are contained in List 1 And all List1 items Are contained in List 2
false: there are different elements


@Abhinavpandey I guess the problem was in the way you used Add to Collection Activity. I tried with many methods, But I couldn’t get the Result because you had added 6 of the Values to the Same List1 instead of Assigning the other 3 Values to List2. :sweat_smile:

I corrected it now.

If you use what @ppr suggested, It Should work Wonderfully well.
Check the Updated xaml : (14.1 KB)

1 Like

Sorry my bad . working fine now
thanks @ppr and @supermanPunch for your help :slight_smile:

1 Like

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