cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
PowerApps Staff rgruian
PowerApps 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
2 REPLIES 2
PowerApps Staff rgruian
PowerApps 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
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
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Top Community Contributors for September  2019

Top Community Contributors for September 2019 🎉🎉

Let's thank our top community contributors

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 434 members 5,861 guests
Please welcome our newest community members: