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 / Filter or sort attachm...
Power Apps
Answered

Filter or sort attachments in gallery to open only pdf file with button

(0) ShareShare
ReportReport
Posted on by 44

Hi, I put a button in my gallery to open the first attachment,I need this button to only open this pdf attachment, the attachment field will always have a single PDFs generated by me using powerautomate so I can give it custom name based on other stuff and JPGs uploaded trought a mobile app.

 

I need the button to always open the PDF attachment and leave the rest:

Kitsutsuki19898_0-1665675837537.png here I used the classic "First(thisitem.attachments).absoluteuri"

 

Kitsutsuki19898_1-1665675887274.pngThis is an example of the PDF file, it will always start with "Modulo_" or whatever is needed/suggested.

 

I know I can for now simply put a " _ " in front of the pdf name to have it as first result, but I would like the file name to be "pretty" thanks

 

 

Thanks in advance!

 

 

Categories:
I have the same question (0)
  • Verified answer
    JasonZF Profile Picture
    572 on at

    This should do the trick. You can filter the source before the First() function. If you want the button within the gallery so it appears on each item:

    Launch(
     First(
     Filter(
     ThisItem.Attachments,
     EndsWith(
     DisplayName,
     "pdf"
     )
     )
     ).AbsoluteUri
    )

     

    If you instead want the button outside the gallery:

    Launch(
     First(
     Filter(
     Gallery1.Selected.Attachments,
     EndsWith(
     DisplayName,
     "pdf"
     )
     )
     ).AbsoluteUri
    )

    If needed, you could also add another filter argument to check for the beginning of the attachment name:

    Launch(
     First(
     Filter(
     Gallery1.Selected.Attachments,
     EndsWith(
     DisplayName,
     "pdf"
     ),
     StartsWith(
     DisplayName,
     "modulo_"
     )
     )
     ).AbsoluteUri
    )

     

  • Kitsutsuki19898 Profile Picture
    44 on at

    WOW, this is so usefull also in other project and stuff I'll work on, thanks a lot!

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 380 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 340

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 333 Super User 2025 Season 2

Last 30 days Overall leaderboard