Hi,
I can think of two ways of doing this.
- Use a condition around the Items property of the Display Form Viewer (on detailscreen1). Use a context variable to determine which situation the user is in.
- Upon clicking the button to Navigate, also Collect the record for viewing.
Both methods will only work if BrowseGallery1 and Gallery2 draw information from the same datasource--in other words, they must have identical columns or it won't work properly.
Method 1
The third argument for Navigate can transfer a context variable.
For the screen browsing/filtering all employees:
Navigate(detailscreen1,Fade,{variable: 1})
For the screen looking at a department of employees:
Navigate(detailscreen1,Fade,{variable: 2})The variable created will determine what situation the user will be in. When the variable is 1, we will make the Display Form Viewer show the information selected in BrowseGallery2. When the variable is 2, we will make the Display Form Viewer show information selected in Gallery2.
Set the Items property of the Display Form Viewer to show the desired record:
If(variable=1,BrowseGallery2.Selected,
variable=2,Gallery2.Selected
)
Sometimes that may not work depending on the configuration of your galleries. You may instead opt to use the unique identifier in your datasource to determine exactly which record you're referring to. In this case, RecordId refers to a field that uniquely identifies each row:
If(variable=1,First(Filter(datasource,RecordId=BrowseGallery2.Selected.RecordId)),
variable=2,First(Filter(datasource,RecordId=Gallery2.Selected.RecordId))
)
So in method 1, the variable determines what record the user will be viewing.
In method 2, you can opt to Collect the exact record you want to avoid ambiguity and variables altogether.
Method 2
Program the Buttons you use for navigating to Collect the exact record you want.
ClearCollect(viewEmployee,ThisItem);
Navigate(detailscreen1,Fade)
The formula above should work, but if there is ambiguity, you can use this to be more specific:
ClearCollect(viewEmployee,First(Filter(datasource,RecordId=ThisItem.RecordId)));
Navigate(detailscreen1,Fade)
The same formula should work for buttons in both BrowseGallery1 and Gallery2 since ThisItem is relative to the stated gallery.
Now that you have collected a record you wish to show, you can configure the Items property of your Data Form Viewer to show the first record of the temporary collection you made:
First(viewEmployee)
Let me know how this works out for you.