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 Apps / Retrieve index of firs...
Power Apps
Answered

Retrieve index of first matching record in table

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi , I am trying to find the index of the first matching record in a table.

 

So for this table,

Apple
Orange
Pear
Grape
Melon

 

I would like to search for "Pear" and get the record index which is 3. How can this be done? The functions such as Find(), LookUp() etc. return the record but not the record index.

Categories:
I have the same question (0)
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous :

    If your data source itself does not have an index, I suggest you use the ForAll function.I've made a test for your reference:

    My data source:

    ClearCollect(YourTable,["Apple","Orange","Pear""Grape","Melon"])

    1\Add a text input control-TextInput3

    2\Add a button and set it's OnSelect property to:

    Clear(Result); /*Result is my custom collection*/
    ForAll(
     YourTable,
     Collect(
     Result,
     {
     No: CountRows(Result) + 1, /*Create a serial number for each record*/
     Value: Value
     }
     )
    );
    

    Select the button

    3\Add a label control and set it's Text property to:

    LookUp(Result,Value=TextInput3.Text).No

    This is the serial number of the first searched record.

    18.gif

    Best Regards,

    Bof

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-bofeng-msft ,

    Thank you very much for the detailed solution! It is exactly what I was looking for. 

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 396 Most Valuable Professional

#2
11manish Profile Picture

11manish 134 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 101 Super User 2026 Season 2

Last 30 days Overall leaderboard