cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tianaranjo
Level 8

Re: Nested Gallery (Gallery within a gallery) - Highlight the selected item in the sub-gallery

 

I am having trouble with this formula.  I am guessing that the '[Order].[OrderDetail] is referencing an excel workbook name and column name?  How would I write for a SharePoint List?  

SortByColumns(GroupBy(Filter('[Order].[OrderDetail]'

Any help on this would be appreciated. 

Super User
Super User

Re: Nested Gallery (Gallery within a gallery) - Highlight the selected item in the sub-gallery

Hi @tianaranjo

 

'[Order].[OrderDetail]' is a reference to a table in SQL Azure DB. [Order] is the schema name (a grouping of tables and other DB objects) and [OrderDetail] is the table name.

 

For a SharePoint list, connect to that datasource and replace '[Order].[OrderDetail]' with the datasource name that represents your SharePoint list.

oyvindmk
Level: Powered On

Re: Nested Gallery (Gallery within a gallery) - Highlight the selected item in the sub-gallery

Great thread of useful information! I am however struggling to do somehing similar. I want to link to an Editform from the sub-gallery, but I am not able to have the record in the subgallery selected and passed on to the Edtiform.

 

- I have a Sharepoint list "Timeforing" with timesheet records, each timesheet record is allocated to a weeknumber, "Ukenr"

- I have made a nested Gallery in PowerApps, where "Gallery1" shows the headerrow with every "Ukenr" and the subgallery "Gallery2" showing each timesheet record.  

  • Gallery1: Items = GroupBy(Timeforing,"Ukenr","ByUke") Gallery2
  • Gallery2: Items = ThisItem.ByUke

- I then want to make a link to an editscreen from each of the timesheet records in "Gallery2" and do that by setting the OnSelect = Navigate(Editscreen2, None) for an Icon placed on the line in the subgallery: 

CapturePA2.PNG

 

The unique record ID is also shown in the subgallery as Text = ThisItem.ID

I then have made the "EditScreen2" with "EditForm1_2" setup with Datasource = Timeforing and  I have tried two alternatives

  1. Item = BrowseGallery2.Selected
  2. Item = First( Filter(Timeforing, ID = Gallery2.Selected.ID))

But both give me the bad result: No item to display when i cklick the link to the EditScreen2

What am I missing ?

Super User
Super User

Re: Nested Gallery (Gallery within a gallery) - Highlight the selected item in the sub-gallery

Hi @oyvindmk

 

If I understand your setup correctly, of your options below:

 

  1. Item = BrowseGallery2.Selected
  2. Item = First( Filter(Timeforing, ID = Gallery2.Selected.ID))

I would not expect 1 to work because the 'record' in the subgallery is the result of your grouping, which will differ from the record format of 'Timeforing'.

I would have expected your second option to work, but you may want to try this alternative:

In your icon on the subgallery, add a third argument to the OnSelect statement - this is a context variable and should be set to ThisItem.ID (assuming ID is your unique key).

OnSelect = Navigate(Editscreen2, None, {varID: ThisItem.ID})

In your edit form set Item as follows:

Item = First( Filter(Timeforing, ID = varID))

To assist troubleshooting you can go to View/Variables to see what value VarID has been set to. You can also try replacing varID in the Item property with a known value so you can check everything else is working OK.

Another advantage to this approach: With your current approach, every time you select something in your subgallery I believe PowerApps will 'recalculate' your Item property on your edit form (like Excel, when you change one value, everything based on that value is recalculated and updated) which may involve going and fetching data. By using a variable, which you only change when someone clicks on your icon, you are limiting recalculation to only when it is required. This should make your app a little quicker.

Yet another advantage of this approach: You may have two (or more) galleries showing similar data. By sending the ID in a variable rather than directly referencing the gallery.selected.id property you could re-use the same edit form for all galleries.

Highlighted
oyvindmk
Level: Powered On

Re: Nested Gallery (Gallery within a gallery) - Highlight the selected item in the sub-gallery

@PaulD1 You are a genius! Your solution worked as a charm, no need for debugging :-) And thanks for the extra advice on the performance issues. I can see that it is necessary to be careful not to hurt the performance.