It sounds like you want to use the same screen and gallery to display existing records and create new records in your PowerApps app. One possible way to do this is to use a variable to control the mode of the gallery, and change the variable value when you click different buttons.
For example, you can set a variable called GalleryMode to either "View" or "New", and use it to determine the items and display mode of the gallery. Here is a sample code that you can try:
- On the screen’s OnVisible property, set the variable to "View" by default:
Set(GalleryMode, "View")
- On the button that shows the selected gallery record, set the variable to "View" and update the gallery items to show only the selected record:
Set(GalleryMode, "View");
UpdateContext({SelectedRecord: Gallery1.Selected});
SelectedRecord
- On the button that creates a new record, set the variable to "New" and update the gallery items to show a blank record:
Set(GalleryMode, "New");
UpdateContext({SelectedRecord: Blank()});
- On the gallery’s DisplayMode property, use the variable to switch between View and Edit modes:
If(GalleryMode = "View", DisplayMode.View, DisplayMode.Edit)
I hope this help.
If you have any questions or feedback, please let me know. Have a great day! 😊
-----------------------
PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]
I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻