cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PaulD1
Super User
Super User

Combine mutliple JSON results into single JSON object for response step

Hi

 

I have a question about combining two result sets into a single set for a Return step. Goal is to have to only call Flow once rather than twice to get the two result steps, improving performance and cutting down on the number of flow calls.

 

Scenario: Triggering from PowerApps, my flow performs a Project Online - List projects step. This gives me the data I want, except for the URL of any associated project sub webs, so I also perform a Send an HTTP request to SharePoint step specifying the Site Address, Method = Get and Uri is _api/web/webs. From the results of that step I can get the SiteUrl and Title (which matches the name of the project with which the sub web is associated).

 

Question: How to return both data sets (from List Projects and HTTP request to SharePoint) as a single result set in the Response step. I would put this into a collection in PowerApps and would expect it to appear as a two column table/record with the result set from List Projects (as a 'nested table') in one column and the result set from Send an HTTP request (as a 'nested table') in the other.

 

Thanks

Paul

4 REPLIES 4
PaulD1
Super User
Super User

So, I've used a Compose step with a createArray function, passing it to my two existing arrays.

 

This does indeed combine my two arrays, one under the other, e.g.

[
  [
    {
      "Table1Field1": "Bill",
      "Table1Field2": "https://..."
    }
  ],
  [
    {
      "Table2Field1": "Ben",
      "Table2Field2": "35",
"Table2Field3": "some other data" } ] ]

Great!

 

But... I am returning this data to PowerApps in a Request - Response step which means I have to provide a valid schema 😞

 

Pasting the example above into the generate payload option of Request - Response gives a schema only for Table1.

 

I am trying to hand craft a schema which is an array with two arrays within it. After much trial and error I have built the following. Some online tools say this is a valid schema and my Flow runs without complaint, but what I get back in PowerApps is a Collection with one Column named Value and one row with the value of True.

 

{
  "type": "array",
  "items": {
    "Table1": {
      "type": "array",
      "properties": {
        "Table1Field1": {
          "type": "string"
        },
        "Table1Field2": {
          "type": "string"
        }
      }
    },
    "Site": {
      "type": "array",
      "properties": {
        "Table2Field1": {
          "type": "string"
        },
        "Table2Field2": {
          "type": "string"
        },
       "Table2Field3": {
         "type": "string"
        }
      }
    }
  }
}

 

What I want to end up is with a collection with one row and two columns. Column 1 would have the contents of Table1, Column 2 would have the contect of Table2.

 

Any tips as to how I can do this? Is this even possible? (I have used some Cognitive Services connectors which return 'complex' data, as in, nested tables and records into a PowerApps collection, so I believe this should be possible if I could just get the syntax correct).

 

Thanks

Paul

Hi Paul

 

We currently are facing the same challenge. Any resolution/workaround you found so far?

Sorry, never found a satisfactory solution. In the end we resorted to doing two Flows, one for each set of JSON.

Hi, 
I am having same type of result of array in Response in Flow, anyone has found any solution for that how to get that arrays in powerapps?

I am getting following data:

Response => OUTPUTS:

{
  "Table1": [
    {
      "ID"19,
      "LogID"1,
      "BldgID"294,
      "SystemID"1
    },
    {
      "ID"20,
      "LogID"1,
      "BldgID"294,
      "SystemID"2
    },
    {
      "ID"21,
      "LogID"1,
      "BldgID"294,
      "SystemID"3
    }
  ],
  "Table2": [
    {
      "LogID"38,
      "SysLogID"19,
      "Element_IDKey"1,
      "Material_IDKey"1,
      "Material_Oth"null
    },
    {
      "LogID"39,
      "LogID"20,
      "Element_IDKey"6,
      "Material_IDKey"36,
      "Material_Oth"null
    }
  ]
}
 
I want to get Table1 and Table2 data in powerapps in collection, how can i get?
 
Thanks

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,512)