web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

OnSelect not running correctly from gallery

(0) ShareShare
ReportReport
Posted on by 236

My solution is saving invoices that arrive by email. (to a SharePoint Document Library) 

It extracts the Invoice data for processing. (the data is written to SQL 'Invoice_Header'/Detail tables)

 

On my Processing form, I have a gallery which lists all invoices that have not been processed.

I have used a gallery showing thumbnail.Large versions of the select invoice, but the image is extremely blurry.

So I trying to add a 'PDF viewer' to display the invoice instead. (it is MUCH clearer and the viewer has tools to zoom in/out if the user want to). 

 

For those who are interested : I have followed this article to get the viewer to display the document.

https://www.matthewdevaney.com/power-apps-view-a-pdf-stored-in-a-sharepoint-document-library/

 

I couldn't get this to work 'natively' (ie: exactly as described above), but I found that if I use a label to pick up the document identifier like this:

Label5.Text = First(Filter(Invoices, ID = Gal_Hdr_LineItems.Selected.Doc_ID)).Identifier

 

Then I could run the flow using

UpdateContext({varDoc: Get_Doc_Preview.Run(Label5).result});

to return the documents content.

Then set  PDF_Viewer.Document=varDoc

That works.

 

However, when I put "UpdateContext({varDoc: Get_Doc_Preview.Run(Label5).result});"  In the gallery's  OnSelect statement,

the varDoc does not run every time that a record is selected.

It seems that if I select a record in the gallery (an get the var to update) then the next time that I select a record, the UpdateContext fails.   Sometimes, If I click on an object outside the gallery, and then select another item, the var gets updated.

 

Any thoughts on what is happening here?   And how to fix it?

Categories:
I have the same question (0)
  • Verified answer
    MissingLink Profile Picture
    236 on at
    Re: OnSelect not running correctly from gallery

    I eventually deleted the gallery and recreated it - Success!

     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 686 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 433 Super User 2025 Season 2

#3
wolenberg_ Profile Picture

wolenberg_ 266 Moderator

Last 30 days Overall leaderboard