cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
khaledhikmat
Level: Powered On

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
Power Apps Staff rgruian
Power Apps Staff

Re: Binding data from a custom connection

 

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
Power Apps Staff rgruian
Power Apps Staff

Re: Binding data from a custom connection

 

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

Highlighted
khaledhikmat
Level: Powered On

Re: Binding data from a custom connection

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

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,026)