Create Single Display Or Edit Form For Multiple Galleries In PowerApps

Overview

 
In this article, we will learn how we can create a common Display Form or Edit Form for different Gallery Sources within the PowerApps.
 

Scenario

 
We have two screens.
  1. Gallery having information about the interviewers whose designation is “BI Developer”.
  2. Gallery having information about all the Interviewers.
Both the screens have a “View More” button. When the user clicks on the View More, a Common Details form should be opened.
 
We need a common form, no matter which screen the user has selected the record from.
 
So, now let’s get started!
 
Step 1
 
We have the following two screens.
 
Gallery with data having the designation = “BI Developer”.

Create Single Display Or Edit Form For Multiple Galleries In PowerApps
 
Gallery with all data.

Create Single Display Or Edit Form For Multiple Galleries In PowerApps
 
Step 2
 
Add a button to “View More” in both the screens.
 
Create Single Display Or Edit Form For Multiple Galleries In PowerApps
 
Step 3
 
Add the following line of the code in Screen1’s Gallery.
 
Here, we have added a Context Variable named “SelectedItem” with the Navigate function. The “SelectedItem” variable store the record which has been selected from the gallery.
  1. Navigate(    
  2.    DetailForm,    
  3.    ScreenTransition.Cover,    
  4.    {SelectedItem: Gallery1.Selected}    
  5. );  
Create Single Display Or Edit Form For Multiple Galleries In PowerApps
 
Step 4
 
Add the following line of code in Screen2’s Gallery.
 
Here, we will use the same context variable named “SelectedItem” which stores Gallery2’s selected item.
  1. Navigate(    
  2.    DetailForm,    
  3.    ScreenTransition.Cover,    
  4.    {SelectedItem: Gallery2.Selected}    
  5. );   
Create Single Display Or Edit Form For Multiple Galleries In PowerApps
 
Step 5
 
We already have a details form.
 
In the details form, we need to set the item value.
 
So, add the following line of code in Detail Form’s item action.
 
Create Single Display Or Edit Form For Multiple Galleries In PowerApps
 
Step 6
 
Now, let’s run the application and select one record from the Galley 1.
 
Create Single Display Or Edit Form For Multiple Galleries In PowerApps
 
Below is the output.
 
Create Single Display Or Edit Form For Multiple Galleries In PowerApps
 
Now, let’s run the application and select one record from the Galley 2.
 
Create Single Display Or Edit Form For Multiple Galleries In PowerApps
 
Below is the output.
 
Create Single Display Or Edit Form For Multiple Galleries In PowerApps
 

Conclusion

 
This is how we can easily create a common detail form or Edit Form for different galleries.
 
I hope you love this article. Stay connected with me for more amazing Power Platform articles like Power BI, PowerApps and MS Flow.
 
Happy PowerApping!


Similar Articles