Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

forEach condition "Contains" element Not Registering

I'm having trouble with PAD recognizing the "contains" function within a forEach loop in two congruent scenarios.





I've extracted the innerHTML strings within the column of a website table, and stored them within the variable "USB_Data_DescHTML".  I then want to perform two separate functions on each item of this variable depending on whether or not its innerHTML contains "<br winautomationvisibilitylandmark="true">".  When I run this action, PAD registers this condition as false even when I'm absolutely positive that the current item contains the aforementioned string.  





Capture2.JPGThe same applies if I attempt to use a List.  This condition also returns a false value when I'm absolutely certain the condition is true.  


What am I missing here?

Super User
Super User

Can you double check the text? Looks like there's some weird formatting going on:



Regular Visitor


Yes, the formatting was wrong in the first example.  However, everything checked out in the second and it still wasn't working.  Therefore, I played around with it some more and discovered that if the two variables are switched then it works. 


So when using the operator "contains" on a List to satisfy an "if" conditional within a forEach loop in Power Automate Desktop, the List needs to be the first operand, and the "current item" of the data being looped needs to be the second operand.  Works like a charm now.


Helpful resources

Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (2,262)