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 / Hide icon if is not th...
Power Apps
Answered

Hide icon if is not the last record

(0) ShareShare
ReportReport
Posted on by 248

Hi all,

 

In this time I have consumed many hours of video tutorials and user manual, and in this moment I building my second App.

 

This is my first post and I know that there is many people with more time of development, but I can't find my answer and I don't know how I can do it.

 

The point is that I have in my gallery, all records and I have added an icon to delete the record, but I only want to have this option only for the last record, and I don't know what condition I need write in "visible".

 

I tried with: "If(BrowseGallery1.Item.ID = Last('origin');true;false)"

 

Thanks.

 

Sorry for my English, I hope that you can understand me... hehehe

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @Manarjomar 

    Are you trying to show an icon only in the final record of the gallery?

     

    Put this code in the Visible property of the icon.

    ThisItem.ID = Last(BrowseGallery1.AllItems).ID

     

    ---
    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."

  • Manarjomar Profile Picture
    248 on at

    @mdevaneythank you for your fast answer, but doesn't works.

     

    The error now is something like "invalid argument type" (in English)Screenshot_2.png

     

    Regards,

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @Manarjomar 

    I found that instead of using Last(Browsegallery.AllItems), use the actual formula for the Items property of the gallery instead.  In my example 

    nwind_ordernumber=First(Filter(Sort( Orders, 'Order Number', Descending ),TextInput2.Text in 'Order Number')).'Order Number'

    Capture.PNG 

  • mdevaney Profile Picture
    29,991 Moderator on at

    @Drrickryp 

    Nice work!

     

    Given that we can now see the OP has a sort control and a search box is there a way to write this which takes into account those elements.?

     

  • Manarjomar Profile Picture
    248 on at

    @DrrickrypIs exacly that I want to do it.

     

    But I don't know how can reply your example in my form because I don't understand the function, but I thought also that I need some come condition over the option "Visible" of the trash icon.

     

    Thank you.

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @mdevaney 

    I'm guessing it depends on whether @Manarjomar  wants to save the last item in the gallery or the last item in the list.  I'm guessing it's the latter. 

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Manarjomar 

    My formula was just an example from a sample database.  You would replace my formula with the Items property of your gallery but sort it by ID, Descending and use First().  I almost never use Last() or Max() in my apps because they are not delegatable and if the list exceeds the PowerApps limit, they will not give the correct value.  First(Sort( Descending  will always work no matter how big the data set is. 

  • Manarjomar Profile Picture
    248 on at

    @Drrickryp  @mdevaney 

     

    I have my list sorted by id, so I want the trash icon visible only over the last record on the list.

     

    I don't want have the option to delete older records, only the last one, so if I want delete older, necesary I will need delate from the last one first.

     

    Thank you.

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Manarjomar 

    Post the items property of the gallery and I will tell you how to write the Visible property of your icon.

  • Manarjomar Profile Picture
    248 on at

    @Drrickryp 

     

    this is:

     

    SortByColumns(Filter([@'RECEPCIÓN DE MATERIALES']; StartsWith(Title; TextSearchBox1.Text)); "idMov"; If(SortDescending1; Descending; Ascending))

     

    thank you

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 76 Most Valuable Professional

#2
Haque Profile Picture

Haque 69

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard