Requirement:
Creating a ‘Nested Gallery’ (group by) within the power apps- when click on a particular button inside the gallery the required details of that particular item reflecting inside the gallery by the other gallery
– gallery displaying in a gallery
taking a blank screen in the power apps, within the screen insert a blank ‘flexible gallery’ which it supports the flexible height.
![](http://rishandigital.com/wp-content/uploads/2022/11/First-screen-1024x567.png)
Select the layout as blank gallery
![](http://rishandigital.com/wp-content/uploads/2022/11/second.png)
in the ‘item’ property the function is ‘group by’ to get the columns required from the datasource, but within the group by we are not able to fetch the choice column we require, so we are going to use the function ‘addcolumns’ within the ‘groupby’ fn because the datasource in the Sharepoint column which we are required to take is a choice column, so by this ‘addcolumns’ we are fetching the choice column into this .
GroupBy(AddColumns('Company ProductsList', "CompanyText", 'Company '.Value),"CompanyText", "CompanyData")
- Company ProductList – SP data source
- CompanyText – which we created to store the text data from the choice column
- Company – it is the choice column
- .Value – the values from the choice column
- CompanyData – the textdata stores into this created source
![](http://rishandigital.com/wp-content/uploads/2022/11/three-1024x428.png)
Insert a button inside the gallery and adjust accordingly, On this button ‘text’ property provide ‘thisitem.companyText” as companyText carries the choice column data from the SP data source
button text property: thisitem.companyText
![](http://rishandigital.com/wp-content/uploads/2022/11/four.png)
all the choice fields are carried into the gallery in buttons
Now Insert a gallery into the Gallery which inserted first – named as Initial gallery & second gallery named as Sub gallery
In the item property fn is ‘thisitem.CompanyData’ where it stores the data from the CompanyText ‘groupby’
SubGallery item property : Thisitem.CompanyData
![](http://rishandigital.com/wp-content/uploads/2022/11/five-1024x507.png)
Now insert a text label to show the require data from the source
where as am displaying the product name, product category , an Icon and a product ID
![](http://rishandigital.com/wp-content/uploads/2022/11/six-1.png)
![](http://rishandigital.com/wp-content/uploads/2022/11/seven-1.png)
![](http://rishandigital.com/wp-content/uploads/2022/11/eight-1.png)
I have made the UI design accordingly
Now to adjust the flexible height for the ‘SubGallery’ i.e the second gallery
On the ‘SubGallery’ Height property use fn
Parent.TemplateHeight-btngal.Height
so the height could be adjustable according to the items in the SubGallery.