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 / Is there a delegable w...
Power Apps
Suggested Answer

Is there a delegable way to show an Index number for the gallery items

(0) ShareShare
ReportReport
Posted on by 1,888 Season of Giving Solutions 2025
We have a vertical gallery that shows items from sharepoint custom list, the gallery has filter and sort functions as follow:-
 
 
but how we can show Index column (the position of the item inside the gallery)? so as the user scroll down the Index will increase, till the user reach the end of the gallery? is there a way to do so in a delegable way? if not, then any workarounds? i am fine to show the index for the first 2000 items (the maximum limit for sharepoint)... thanks,
 
I have the same question (0)
  • Suggested answer
    RobElliott Profile Picture
    10,495 Super User 2026 Season 1 on at
    In the items property of your gallery add something like this:
     
    With(
        {
            CountRow: Sort(
                Filter(
                    'Champions Activity Leaderboard',
                    Or(
                        IsBlank(cbRegion.Selected.Value),
                        Region = cbRegion.Selected.Value
                    )
                ),
                Points,
                SortOrder.Descending
            )
        },
        ForAll(
            Sequence(CountRows(CountRow)),
            Patch(
                Last(
                    FirstN(
                        CountRow,
                        ThisRecord.Value
                    )
                ),
                {Sequence: Value}
            )
        )
    )
     
    Then you can display the Sequence value with ThisItem.Sequence as shown below. As you filter the gallery it will display the new set of sequence numbers.



    Rob
    Los Gallardos
    Principal Consultant, Power Platform, WSP Global (and classic 1967 Morris Traveller driver)
  • Suggested answer
    Kalathiya Profile Picture
    2,007 Super User 2026 Season 1 on at
    Hello @johnjohnPter
     
    Please try below approach:
     
    Put below code in Gallery Items Property:
     
    
    With({ 
        _data:Sort(
            'Business Service Orders', //Replace with your SharePoint list name - Apply filter here if needed
            Created,
            SortOrder.Ascending
            )
        },
    
        ForAll(
            Sequence(CountRows(_data)),   
            Patch(
                Index(_data, Value),     
                { RowIndex: Value }       
            )
        )
        
    )
    if you want to use collection then put colIndexed collection in gallery
     
    Put below code on button or screen on visible property and use "coIndexed" collection in Gallery
    ClearCollect(
        colRaw,
        Sort(
            YourSharePointList, //Replace with your sharepoint list
            YourSortColumn, //replace with your sort order column name
            SortOrder.Ascending
        )
    );
    
    ClearCollect(
        colIndexed,
        ForAll(
            Sequence(CountRows(colRaw)),   
            Patch(
                Index(colRaw, Value),      
                { RowIndex: Value }        
            )
        )
    );
     
    If this response resolves your issue, please mark it as the Verified Answer so it can help other community members as well.
    ---------------------------------------------------------------------------------

    📩 Need more help? Just mention @Kalathiya and I’ll be happy to assist.

    ✔️ If this answer helped you, please tick “Does this answer your question?” so it can be marked as the Verified Answer.

    💛 A Like always motivates me to keep contributing!

  • Suggested answer
    BCBuizer Profile Picture
    22,675 Super User 2026 Season 1 on at
     
    A slightly different approach from @RobElliott, but with a similar outcome, just so you see there's more than one way to do it:
     
    With(
        {_Input: Filter(...)},
        RenameColumns(
            Ungroup(
                AddColumns(
                    Sequence(CountRows(_Input)),
                    _Record,
                    Table(
                        Index(
                            _Input,
                            Value
                        )
                    )
                ),
                _Record
            ),
            Value,
            Index
        )
    )
     
    If this reply helped you in any way, please give it a Like 💜 and in case it resolved your issue, please mark it as the Verified Answer ✅.
  • johnjohnPter Profile Picture
    1,888 Season of Giving Solutions 2025 on at
    @
    but in this case the RowCount will/can only hold 2000 items, so if  the user scroll down nothing will be shown after 2K items? am i correct?
  • WarrenBelz Profile Picture
    155,300 Most Valuable Professional on at
    EDIT - I just saw your latest post - you seem to be asking this question.

    Firstly all the responses above cover indexing numbering your gallery up to your maximum Power Apps Data Row Limit of 2,000 (this is not a SharePoint Limit), but you may be asking a different question here (if not, disregard this post). You refer to Delegable and this is a bit of a double-edged sword. Using @Kalathiya's example: -
    With(
       { 
          _data:
          Sort(
             'Business Service Orders', //Replace with your SharePoint list name - Apply filter here if needed
             Created,
             SortOrder.Ascending
          )
       },
       ForAll(
          Sequence(CountRows(_data)),   
          Patch(
             Index(
                _data, 
                Value
             ),     
             {RowIndex: Value}       
          )
       ) 
    )
    If the the top filter inside the With() statement is Delegable, then it will action directly in SharePoint and (for example) if the filter was just this without the numbering
    Sort(
       'Business Service Orders', //Replace with your SharePoint list name - Apply filter here if needed
       Created,
       SortOrder.Ascending
    )
    it would return any number of records to the gallery, however the With() function actually creates a (very) temporary local variable and the output is subject to your Data Row Limit. So in essence, the query inside the statement (if Delegable) runs to SharePoint (the list can be of any size), however the returned records are capped at your Data Row Limit. So essentially if you are returning less than 2,000 records, all is well, but if you are expecting more, you are only going to get (the first) 2,000 numbered records back.
     
    The fundamental issue is that you cannot Delegate anything outside the filter to SharePoint (this includes adding/renaming columns and a number of other things), so it has to be done locally after the records are returned, and therefore subject to your Data Row Limit. 
     
    Depending on whether you can "split" your filter into more than one Delegable query (all under 2000 records), you may be able to achieve this by "stacking" collections. As an example if you had two (you can do more) products Blue and Red, each under 2,000 items, you could do a Collection
    With(
       {
          _Data1: Filter(
             SPList,
             Product = "Blue"
          ),
          _Data2: Filter(
             SPList,
             Product = "Red"
          )
       },
       ClearCollect(
          colProducts,
          _Data1,
          _Data2
       )
    )
    and then your Gallery Items
    ForAll(
       Sequence(CountRows(colProducts)),   
       Patch(
          Index(
             colProducts, 
             Value
          ),     
          {RowIndex: Value}       
       )
    ) 
     
    Please Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like
    Visit my blog
    Practical Power Apps    LinkedIn  
  • johnjohnPter Profile Picture
    1,888 Season of Giving Solutions 2025 on at
    @ thanks for the reply, but in this case the gallery will not be able to load/show more than 2000 items , am i correct?
  • WarrenBelz Profile Picture
    155,300 Most Valuable Professional on at
    That is correct - a possible solution is in my post

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,045

#2
Valantis Profile Picture

Valantis 675

#3
11manish Profile Picture

11manish 592

Last 30 days Overall leaderboard