cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tagordon90
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.

 

#1:

Capture1.JPG

 

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.  

 

----

 

#2

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?

2 REPLIES 2
Henrik_M
Super User
Super User

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

Henrik_M_0-1619949460370.png

 

tagordon90
Regular Visitor

@Henrik_M 

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.

Capture.JPG

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Top Kudoed Authors
Users online (3,527)