Hi all,
I am trying to set a record to a variable from multiple controls and receiving an incompatibility error, even though the two definitions are both records.
I am building an app that allows users to search a collection to find a needed document, select it, and bring it up in the PDF viewer. When a user selects an item from the gallery, it sets varItem as searchGallery.Selected, then navigates to the search result screen. OnVisible, the search result screen runs a PowerAutomate flow to retrieve the PDF data of the selected item using varItem.
Search Result Screen

Selected Item screen

My issue is that I don't simply have one gallery that users can select to set varItem, but 2. When a user selects the "Show Related" button on the search result screen, it brings up a gallery of related documents they can also launch. This has the same syntax as the original gallery, Set(varItem, searchGallery.Selected), however it produces an error saying my variable types are mismatched:
Related Documents Gallery

I know that the only two definitions of varItem define it as a record. Is there a way to define a variable from multiple locations or another workaround? Any guidance would be appreciated.
Thanks!