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

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

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard