cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lparkerMDVIP
Level: Powered On

Add Row Number to Gallery in PowerApps

Hello everyone! 

 

Here is the current formula for my Gallery's Item Property:

 

FirstN(SortByColumns(AddColumns(GroupBy('SP Data Source', "Points_x0020_Given_x0020_To","ByEmployee"),"Points Given", Sum(ByEmployee,PointsGiven)),"Points Given",Descending),10)

 

It currently provides a distinct last of names and the # of points each person has accumulated.

Example:

 

SharePoint List Items:

Bob        5

Steve      5

Bob        7

Steve    10

Joe         8

 

Gallery in PowerApps:

Steve   15

Bob     12

Joe       8

 

I would like to add row numbers to the gallery after grouping the items by name.

 

2 REPLIES 2
Super User
Super User

Re: Add Row Number to Gallery in PowerApps

@lparkerMDVIP 

If you want to make a new column with a row number I suggest you check out this blog post by forum user Tim Leung: http://powerappsguide.com/blog/post/generating-row-numbers

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Community Support Team
Community Support Team

Re: Add Row Number to Gallery in PowerApps

Hi @lparkerMDVIP ,

Could you please share a bit more about your scenario?

Do you want to add a Row Number Index into your Gallery?

 

Based on the needs that you mentioned, I have made a test on my side, please consider take a try with the following workaround:

Set the OnStart property of the App to following:

Clear(RecordsCollection);
ForAll(
       AddColumns(
                  GroupBy('SP Data Source', "Points_x0020_Given_x0020_To", "ByEmployee"),
                  "Points Given", 
                  Sum(ByEmployee, PointsGiven)
       ),
       Collect(
               RecordsCollection,
               {
                   RowIndex: CountRows(RecordsCollection) + 1,
                   PointsGivenTo: 'Points Given To',
                   PointsGiven: 'Points Given',
                   EmployeeTable: ByEmployee
               }
       )
)

Set the Items property of the Gallery to following:

FirstN(
       SortByColumns(RecordsCollection, "PointsGiven", Descending),
       10
)

Then re-load your app (fire the OnStart property of App), check if the issue is solved.

 

Within your Gallery, you could reference the Row Index value through the following formula:

ThisItem.RowIndex

 

More details about the ForAll function, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-forall

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Platform 24

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (5,120)