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 Apps / How to get the record'...
Power Apps
Answered

How to get the record's index number in the table

(0) ShareShare
ReportReport
Posted on by 13

collect(test, {demo:a}, {demo:b}, {demo:c});

I want to get index number of 1 for a;

I want to get index number of 2 for b;

I want to get index number of 3 for c;

How to get?

Categories:
I have the same question (0)
  • Verified answer
    cdwhite Profile Picture
    1,067 Most Valuable Professional on at

    Hi @Camille666 ,

    With your collection created, you can add the following Power Fx to the items property of a gallery (for example) to get the row numbers/index:

    // Apply row number to collection
    Ungroup(
     ForAll(
     Sequence(CountRows(test)),
     {
     Record: Table(Index(test,Value)),
     RowNumber: Value
     }
     ),
     "Record"
    )

    If you needed the indexed values in a collection, you could do something like:

    // Build test collection
    ClearCollect(test, {demo:"a"}, {demo:"b"}, {demo:"c"});
    
    // Apply row number to collection
    ClearCollect(testIndexed,
    Ungroup(
     ForAll(
     Sequence(CountRows(test)),
     {
     Record: Table(Index(test,Value)),
     RowNumber: Value
     }
     ),
     "Record"
    ))

    ------------------------------------------------------------------------------------------------------------------------------
    If I've answered your question, please mark your post as Solved. You can accept more than one post as a solution.

    If my response was a good one, please give it a Thumbs Up!

    Visit my blog: https://platformsofpower.net

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard