cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
khaledhikmat
Advocate III
Advocate III

Binding data from a custom connection

Hello, I have a custom connection that returns data that looks like this:

 

{
  "id": "Global",
  "name": "Global",
  "parent": "",
  "type": "Global",
  "lastRefresh": "2016-11-12T14:57:11.569507+00:00",
  "children": [
    {
      "id": "Europe",
      "name": "Europe",
      "parent": "Global",
      "type": "region",
      "lastRefresh": "2016-11-12T14:57:11.569507+00:00",
      "weeks": [
        {
          "id": 36,
          "name": "03 Sep 2016",
          "date": "2016-11-12T14:57:11.7257861+00:00",
          "amounts": {
            "netSales": 399,
            "netRevenue": 66972.2625,
            "cancellations": 24,
            "programProfit": 0,
            "hmcProfit": 0
          }
        },
        {
          "id": 37,
          "name": "10 Sep 2016",
          "date": "2016-11-12T14:57:11.7257861+00:00",
          "amounts": {
            "netSales": 395,
            "netRevenue": 66705.9188,
            "cancellations": 10,
            "programProfit": 0,
            "hmcProfit": 0
          }
        }
	]
	}
  ]
}

I am able to bind the children to a gallery in PowerApps, but I am not able to bind the amounts such as netSales, netRevenue, etc. I expected something like amounts.netSales....but that does not work!

 

Also....is there a limitation on nesting galleries? I am not able to nest in a screen more than two galleries deep...the third one does not let me place it inside the parent gallery!!

 

Really appreciate any help. I tried PP before....but now I have a real app I would like to try it for.

 

Regards,

1 ACCEPTED SOLUTION

Accepted Solutions
rgruian
Power Apps
Power Apps

 

In your schema, it looks like "amounts" is a record, not a table. Just curious, why are you trying to nest 3 levels deep? If you bind an inner gallery to "weeks", you should be able to access netSales, etc. as:

 

   ThisItem.amounts.netSales

 

Yes, there are limits on nesting galleries. Each additional nesting level increases the algorithmic complexity of the outer gallery itself by a factor of N. So for example a gallery that is 2 levels deep will have an algorithmic complexity of O(N^2); a gallery that's 5 levels deep would have an algorithmic complexity of O(N^5); and so on.

 

If you need to "reach" and render data that is more than 2 levels deep, I recommend that you either flatten it, or transform it via a formula (e.g. using functions such as AddColumns, Ungroup, etc) to bring that "deep" data up. Also, instead of nesting galleries, I recommend chaining them, so that the result of a gallery flows into the input of a subsequent one, which in turns flows into another one, etc -- effectively allowing you to maintain < O(N^2) algorithmic complexity, for very obvious performance and scalability reasons.

 

I hope this helps.

 

Radu Gruian [MSFT] ** PowerApps Staff

View solution in original post

2 REPLIES 2
rgruian
Power Apps
Power Apps

 

In your schema, it looks like "amounts" is a record, not a table. Just curious, why are you trying to nest 3 levels deep? If you bind an inner gallery to "weeks", you should be able to access netSales, etc. as:

 

   ThisItem.amounts.netSales

 

Yes, there are limits on nesting galleries. Each additional nesting level increases the algorithmic complexity of the outer gallery itself by a factor of N. So for example a gallery that is 2 levels deep will have an algorithmic complexity of O(N^2); a gallery that's 5 levels deep would have an algorithmic complexity of O(N^5); and so on.

 

If you need to "reach" and render data that is more than 2 levels deep, I recommend that you either flatten it, or transform it via a formula (e.g. using functions such as AddColumns, Ungroup, etc) to bring that "deep" data up. Also, instead of nesting galleries, I recommend chaining them, so that the result of a gallery flows into the input of a subsequent one, which in turns flows into another one, etc -- effectively allowing you to maintain < O(N^2) algorithmic complexity, for very obvious performance and scalability reasons.

 

I hope this helps.

 

Radu Gruian [MSFT] ** PowerApps Staff

View solution in original post

Yes...thank you for the AddColumns function. I got most everythiung to work now.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,278)