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 / Challenge with RowNo S...
Power Apps
Answered

Challenge with RowNo Solution in Gallery

(0) ShareShare
ReportReport
Posted on by 716 Moderator

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:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,075 Most Valuable Professional on at

    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

  • DCHammer Profile Picture
    716 Moderator on at

    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. 

  • DCHammer Profile Picture
    716 Moderator on at

    You are of course, once again, correct. 

    Thanks Warren.

     

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

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