cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Power Apps
Power Apps

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
Highlighted
Power Apps
Power Apps

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
Advocate III
Advocate III

Re: Binding data from a custom connection

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

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

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (6,216)