cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How to check for First or Last items of a Gallery

Hi all,

 

Currently building an app where users can request and approve company travel items.

 

I've built the UI of the "overview" screen as a timeline of travel events (flights, etc). Wondering whether anyone out there might know how to detect whether a given item is the First or Last one in a gallery? Would be useful in showing or hiding aspects of the UI to dictate whether the timeline ends or starts from a particular item.

Cheers

1 ACCEPTED SOLUTION

Accepted Solutions
Meneghino
Community Champion
Community Champion

Hi @Anonymous

 

You can use the First and Last functions.  If outside the gallery then you can use the AllItems property of the gallery.

For example:  If(Gallery1.Selected = First(Gallery1.AllItems), XXX, YYY)

 

If inside the gallery (i.e. for a control in the gallery template) then I think that you cannot use AllItems, so just use First or Last with the same expression as the Items property of your gallery.

 

Please provide specific needs (incl. Items property) if the above is not clear enough.

View solution in original post

3 REPLIES 3
Meneghino
Community Champion
Community Champion

Hi @Anonymous

 

You can use the First and Last functions.  If outside the gallery then you can use the AllItems property of the gallery.

For example:  If(Gallery1.Selected = First(Gallery1.AllItems), XXX, YYY)

 

If inside the gallery (i.e. for a control in the gallery template) then I think that you cannot use AllItems, so just use First or Last with the same expression as the Items property of your gallery.

 

Please provide specific needs (incl. Items property) if the above is not clear enough.

View solution in original post

Anonymous
Not applicable

Worked brilliantly. Thanks @Meneghino ! 🙂

BMALT
Frequent Visitor

I am trying to apply this idea inside a gallery, on the visible property of an icon. I can't seem to get the syntax right, I'm getting "invalid argument type." Inside the gallery it would be ThisItem=Last(whatever)?


If(ThisItem=Last(Filter(Datasource,Field=value,Field2=Value2)),true,false)

 

I'm pretty sure "ThisItem" is the single record within the gallery - if I start typing

If(ThisItem.

I see the fields of the table in question in the auto fill area

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,435)