I have a similar problem. I have a Gallery of PDF files (from a Document Library, but that doesn't matter). When a user selects a document from the Gallery, I show that PDF in a PDFViewer control (using lookups, but again, that doesn't matter). The PDF then appears and can be browsed. The problem I face without a Reset() function is when the selected gallery document does not have a PDF, the last selected PDF remains displayed.
I want to simply add to the OnSelect of the Gallery Reset(PDFViewer).
For Brevity, my basic code (psudocode) in the Gallery OnSelect is:
LookUp(DocumentLibrary, Name = ThisItem.Selected.Title);
Reset(PDFViewer)
The basic code (psudocode) of the Gallery Items is:
SortByColumns(
Search(
Filter(DocumentLibrary, DocStatus = "Published"),
filterTitleInput.Text,
"DocTitle"
),
"DocTitle",
Ascending
)
For the PDFViewer, I use a helper list where documents are uploaded. Authorized users may upload or delete files to/from the helper list through a form. When files are added to the list, a back-end Flow copies the file to the Document Library and marks it as Published. When a file is deleted from the list, the Flow simply marks the file as Obsolete. The basic code for the PDFViewer Document is:
First(
Filter(
LookUp(
HelperList,
Department = Gallery.Selected.DocDepartment &&
DocumentType = Gallery.Selected.DocTypeB &&
DocumentNumber = Gallery.Selected.DocSeries &&
DocumentRevision = Gallery.Selected.DocRevision
).'{Attachments}',
Gallery.Selected.Name
in DisplayName
)
).Value
So, while the Gallery is showing documents from the Document Library, the PDFViewer is returning the origin document from the sharepoint list. (Not that it matters, but the Launch() for PDFViewer opens the file from the Document Library, not the HelperList).
The need of a Reset() in this process is due to a de-sync which occurs during testing and not during normal process. In addition to a Reset(), the ability to open a File from a Document Library in the PDFViewer would be awesome!