Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Challenge with RowNo Solution in Gallery

(0) ShareShare
ReportReport
Posted on by 714 Super User 2025 Season 1

So like others, I wanted the separator at the bottom of the gallery template to not appear on the last row.

 

This works:

 

With(
 {
 wList: Sort(
 Filter(
 'SPIFF - Requests',
 galFilter.Selected.Value = "All" || Status.Value = galFilter.Selected.Value
 ),
 Created,
 SortOrder.Descending
 )
 },
 ForAll(
 Sequence(CountRows(wList)),
 Patch(
 Index(
 wList,
 Value
 ),
 {RowNo: Value}
 )
 )
)

 

My challenge is that it broke the navigation to the data entry/edit form.

The OnSelect for the Gallery is this:

 

Set(varItem,ThisItem); ResetForm(frmRequest);ViewForm(frmRequest);Navigate(FormScreen)

 

The frmRequest.ltem = varItem. (This is what broke)

 

I don't really understand what is wrong but my suspicion is that ThisItem points to the record in wList which is not actually a real record from the original datasource.

And as I write this, I think the solution is to go and pick up the source record based on the ID value of the record in wList. 

 

{Pause}

{Unpause}

 

And the solution is this:

 

First(Filter('SPIFF - Requests', ID=varItem.ID))

 

From the inside out, the Filter finds the record(s) where the ID field matches the ID field in the record defined by varItem. But since Filter returns a table, we need just one row. This took me far too long to figure out on my own but here we are. And since I know that ID=varItem.ID can only ever return one record in that table, just grabbing the first record with First will never fail. 

 

Thanks again for attending my self tutorials. I leave a trail of my learning here because it provides me with a referenceable repository of my own troubleshooting and problem solving as well as providing solutions for others.

Categories:
  • DCHammer Profile Picture
    714 Super User 2025 Season 1 on at
    Re: Challenge with RowNo Solution in Gallery

    You are of course, once again, correct. 

    Thanks Warren.

     

    I have a new puzzle to solve. Post coming soon. 😄

  • DCHammer Profile Picture
    714 Super User 2025 Season 1 on at
    Re: Challenge with RowNo Solution in Gallery

    I’ve accepted it as the solution Warren but I seem to remember actually trying that very statement but it didn't work. I’ll test and reply. 

  • Verified answer
    WarrenBelz Profile Picture
    146,668 Most Valuable Professional on at
    Re: Challenge with RowNo Solution in Gallery

    Hi @DCHammer ,

    You actually need

    LookUp(
     'SPIFF - Requests', 
     ID = varItem.ID
    )

    which returns a record (the first matching one which will always be the same as ID is unique)
    The reason is that when you change the structure of a Table and add a field as you have done with the sequential number, only the gallery can "see" this and when you set the Form Item to a Variable based on this, it does not match any record in the data source - the Variable has an extra field.
    You should use your end result with the LookUp every time on a Form (whether the Variable matches field or not), as you are querying the data source directly and will find it refreshes with any changes, where it will not if based on a Variable unless you also refresh that Variable.

     

    Please click Accept as solution 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 giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,668 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard