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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Loop throws index out ...
Power Automate
Unanswered

Loop throws index out of range.

(0) ShareShare
ReportReport
Posted on by 8

So I'm trying to have the name of all folder in a folder, then remove the file path of the name so I can get the name alone. It gives me an index error, but it still works great so it doesn't really matter there. The thing is, this was one part of a bigger flow. And when this error get thrown, it stops the rest of the flow, which is a problem there.

Xiarno_0-1644360872980.png

Xiarno_1-1644360883209.png

How to fix this if possible please ?

I have the same question (0)
  • Verified answer
    MichaelAnnis Profile Picture
    5,727 Moderator on at

    Loop 0 to %Folders.Count - 1%

     

    Since the list has a 0 based index, there is 1 less index than number of rows.  Count returns the number of rows, so you have to subtract 1 to loop on indexes.

  • Community Power Platform Member Profile Picture
    on at

    Dunno, to me it seems like loops should be < not <= when doing the Count or Length comparison.

     

    Seems strange that this stayed the same since WinAutomation transition.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard