Search code examples
powerapps

detail screen from grouped gallery


I've built a Powerapp from a very simple excel file (MyData) with 3 columns (A,B, C).

Now I've 3 screens from the template: Browse, Detail, Edit. In the Browse screen, I've added a new Gallery grouping the original MyData by column "A" GroupBy(MyData;"A";"GroupedData"). Then I added a SubGallery ("GroupedGallery") with single items from Mydata (ThisItem.GroupedData). In this Subgallery I have a right arrow and I'd like to point to Detail Screen So I added a second Detail screen (Detail2), In the right arrow property I've changed the OnSelct Property to "Navigate(Detail2)".

I've tried many things on the Detail2 screen but I couldn't manage to have the details of the selected item.

Among those, on the Item Property I tried to write "GroupedGallery.Selected".

Do you have any suggestions? Thanks


Solution

  • When navigating to the second screen, you can use the third argument to the Navigate function to pass the item that you want edited on the form - which you can get within the nested gallery with the ThisItem value:

    Navigate(Detail2; ScreenTransition.Fade; { selectedItem: ThisItem })
    

    And in the Item property of the form on the Detail2 screen you would use selectedItem.

    Notice that the ThisItem value of the nested gallery does not have the grouped column (A). If you want that, you can use the Patch function to merge it into the value passed to the Detail2 screen on the Navigate function:

    Navigate(
        Detail2;
        ScreenTransition.Fade;
        { selectedItem: Patch(ThisItem; { A: OutsideGallery.Selected.A }) })