Suppose I have two lists,
List 1 = List of names
List 2 = List of emails that might contain these names
I want to iterate through each name in List 1 and check against List 2 to see if any emails contain the names.
How do I do this?
I know I have to use a for each loop but I’ve never worked with multiple lists like this before.
If someone could send an example xaml I’d be SOOO grateful!
U can do like this
Iterate List A with names using For Each
Then use If ListB.Contains(Item.ToString)
@Suzana_Joby Can you tell us what should be your Output ? We can go with the For Each but if you would tell us the End Result that you need, then we might be able to give you the best solution possible.
Hope the following helps you.
Sequence.xaml (8.2 KB)
So I want either two results
- it finds the name in an email.
In this case, I want to do some processing and move onto next name
- it doesn’t find name in List 2
Let’s say for Sarah, the bot will go through EVERY mail in List 2, if it doesn’t find the name in any emails, then I’ll do some processing and move onto next name
Thanks, will try this an get back to you
@Suzana_Joby, you can also use two for each activity, the outter for each will iterate through names, and the inner for each will iterate through emails. how this works is:
The outter loop will go once and then the inner loop will go until the finish, and then the outterloop will go for the second time the inner loop again goes till the end. so in your case the outter loop will take Sarah and will compare with all three emails carried by the inner loop and so on. This might be confusing but i think for what you want to do, it will be the best. inside the inner loop you will need an if activity checking if the name is contained on an email.
I also made an example for you, have a look and let me know what you think about it.
Main.xaml (8.2 KB)
Fantastic! This is what I wanted, thank you
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.