cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

PowerApps Nested Gallery Filtering

Hi all,

 

Question about filtering a gallery within a gallery in PowerApps. Here's the scenario:

 

I have a grid-like gallery that contains 10 different workstations as the respective items. Furthermore, within each of these items, I have attached a gallery within each that contains build records for that specific workstation. The problem is that the underlying data source has the build records all in one table with a "Workstation" column rather than having separate data sources. I would like to filter the inner gallery by the parent gallery "Title" text item label control. I am not sure if this is possible, but I cannot seem to find any documentation on the syntax needed for this. 

 

Thanks,

Farhan

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: PowerApps Nested Gallery Filtering

When a Gallery is nested within a Gallery, there are some syntax specifics to note.

 

The nested gallery will have a ThisItem context, which represents the row for the nested table.

  • Used like an other gallery, to access the contextual Row and its field values

 

HOWEVER, the Items property (and maybe others), has a different Context for ThisItem

  • Here, ThisItem refers to the top gallery row, which the nest gallery is...well, nested
  • This means you can access the parent gallery row to
    • Use it for filtering
    • Use a table attribute (like a child relationship) as the source of records

 

In a default CDS instance, for example

  • Create a canvas app
  • Add a Gallery, Items = Accounts
  • Add a nested Gallery, Items = ThisItem.Accounts

The nested gallery above will be populated with the child records (via Parent Account relationship), of the Account in that row.

 

For yours, you may have to configure the nested gallery with a different data source, but you can at least apply a filter such as

  • Filter(Table, Workstation = ThisItem.Workstation)

View solution in original post

5 REPLIES 5
Highlighted
Super User III
Super User III

Re: PowerApps Nested Gallery Filtering

How many galleries do you intend to build. Table name and columnName will help. Kindly watch this video from Shane Young
https://youtu.be/nlhWQg03TL0

If you like this post give thumps up. If it resolved your question then mark as a solution
Highlighted
Super User II
Super User II

Re: PowerApps Nested Gallery Filtering

When a Gallery is nested within a Gallery, there are some syntax specifics to note.

 

The nested gallery will have a ThisItem context, which represents the row for the nested table.

  • Used like an other gallery, to access the contextual Row and its field values

 

HOWEVER, the Items property (and maybe others), has a different Context for ThisItem

  • Here, ThisItem refers to the top gallery row, which the nest gallery is...well, nested
  • This means you can access the parent gallery row to
    • Use it for filtering
    • Use a table attribute (like a child relationship) as the source of records

 

In a default CDS instance, for example

  • Create a canvas app
  • Add a Gallery, Items = Accounts
  • Add a nested Gallery, Items = ThisItem.Accounts

The nested gallery above will be populated with the child records (via Parent Account relationship), of the Account in that row.

 

For yours, you may have to configure the nested gallery with a different data source, but you can at least apply a filter such as

  • Filter(Table, Workstation = ThisItem.Workstation)

View solution in original post

Highlighted
Advocate I
Advocate I

Re: PowerApps Nested Gallery Filtering

Thank you @GarethPrisk! I was wondering what the syntax would be for a gallery nested in a form? I can create a related gallery outside of the form with the same syntax you used, but not inside a form's custom card. I have tried testing by hard-coding the ID value, but I'm wondering if I should not be using Filter function since the literal is not accepted. (Tested both inside and outside fo the form. Works outside, not inside.)

Highlighted
Super User II
Super User II

Re: PowerApps Nested Gallery Filtering

@Olivia_DudleyI am not sure that you can embed a Gallery control within any part of a Form control, unfortunately. The Gallery will exist outside the context of the form.

That being said, there are some overlapping properties between a Form and a Gallery which we can leverage. My assumption is that you are trying to show related records, for the record being displayed in the Form - is this correct?

If so, let's assume:

  • We have an initial Accounts Gallery (galAccount)
    • Items = Accounts
  • We have an Account Form (frmAccount)
    • DataSource = Accounts
    • Item = galAccount.Selected
  • We add an additional Gallery for Child Accounts (galChildAccounts)
    • DataSource = Filter(Accounts,'Parent Account'.Account = galAccount.Selected.Account)

As you can see, both the Form's Item and the second Gallery's Filter are using the selected Item from the first Gallery.

I would go a step further and turn galAccount.Selected into a context or global variable, to help performance.

Highlighted
Advocate I
Advocate I

Re: PowerApps Nested Gallery Filtering

Alas, this is as I figured. My form has tabs which shows data cards based on the tab selected. It appears the solution of creating the gallery outside with similar visible settings will suffice.

 

Thanks again!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,916)