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 / maximum index value of...
Power Automate
Answered

maximum index value of a list variable

(0) ShareShare
ReportReport
Posted on by 41

Using the "Read Text from file", I'm storing the contents into a List variable. I simply need to know how many lines the text file contains. Without looping through each index and manually incrementing a LineNum variable, is there a function that would tell me the maximum index value?

 

Many Thanks!

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

    If you have a list stored as %List%, you can get the number of items in it as %List.Count%.

    -------------------------------------------------------------------------

    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.

     

  • treddfw Profile Picture
    41 on at

    Thank you very much! I was looking too hard for a solution, and yours is perfect! 

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    But if you are looking for that to be your loop max, then you want %List.Count - 1% if your %LoopIndex% is being used to reference the row you are looking for in your list. Because the list is a 0 based index, the first item is 0, the second is 1, so on and so forth until the last item is %List.Count - 1%. 

    Then, when you need to call that row in the loop, you say:

     

    %List[LoopIndex]%

    Good luck!

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 266 Super User 2026 Season 2

#2
trice602 Profile Picture

trice602 160 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 134 Super User 2026 Season 2

Last 30 days Overall leaderboard