web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to compare an arra...
Power Automate
Unanswered

How to compare an array item with a variable?

(0) ShareShare
ReportReport
Posted on by 18

I am working on webscraping where I want to compare 2 values:

 

1. Values extracted from web as a list

2. Values extracted as a single variable-around 5 individual variables

 

I want to run a comparison of each value of the list with these 5 variables 

 

My approach-

Using a for each loop and fetching each item in array using a counter,countervariable.-currentitem[countervariable]

The problem is as soon as the countervariable is 1 it throws an error-'Index 1 is out of range'

I want to use- if currentitem[countervariable]='web attribute value extracted as a single variable'

 

How can I go about it?

 

 

I have the same question (0)
  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    If you are using a For each loop, you do not need a counter/index variable. Your %CurrentItem% will store the value of the current iteration of your loop. So you can simply do If %CurrentItem% = %AttributeValue% (from the web).

     

    The index/counter is only relevant when you are using a different kind of loop. You would then target the list itself with the counter, instead of %CurrentItem% - e.g. %List[CounterVariable]%.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @luckyra 

     

    Another way you can give a try 🙂

     

    see below 

    Nived_Nambiar_0-1702480789083.png

     

     

    Assume list variable is the list which you got as output from webpage in form of list. and  are the variables which have been extracted as single values.

     

    Now loop through single value variables by enclosing in list like as i did below:

    Nived_Nambiar_1-1702480856166.png

     

    Now using if condition, check whether the currentitem is present in list or not like below:

    Nived_Nambiar_2-1702480893024.png

     

    if it is present, as per my flow, it will display a message box, may be as per your requirement you can change that if you need so.

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 468

#2
Haque Profile Picture

Haque 370

#3
Valantis Profile Picture

Valantis 354

Last 30 days Overall leaderboard