cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
aec2018
Microsoft
Microsoft

Can I create multiple collections from one connector response having different nested arrays?

I'm trying to populate a few different dropdowns from an API response. Instead of making two different calls, is it possible to create two collections if the response has two different arrays? For example:

 

{
 itemList1: ["foo", "bar"],
 itemList2: ["baz", "qux"
}

 

Right now, I can do ClearCollect(itemList1Options, APICall(apiCallHere).itemList1) to to assign the first array. But I can only figure out to how to save the second array to a collection by making a whole new call and using .itemList2 to extract it. How can I do this in just one call? 

1 ACCEPTED SOLUTION

Accepted Solutions
iAm_ManCat
Super User
Super User

Hi @aec2018 

 

You could set the response as a variable and then reference the variable sub-properties 🙂

 

Set(gblAPIResponse, APICall(apiCallHere));
ClearCollect(itemList1Options, gblAPIResponse.itemList1);
ClearCollect(itemList2Options, gblAPIResponse.itemList2);
ClearCollect(itemList3Options, gblAPIResponse.itemList3);

 

Cheers,

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

3 REPLIES 3
iAm_ManCat
Super User
Super User

Hi @aec2018 

 

You could set the response as a variable and then reference the variable sub-properties 🙂

 

Set(gblAPIResponse, APICall(apiCallHere));
ClearCollect(itemList1Options, gblAPIResponse.itemList1);
ClearCollect(itemList2Options, gblAPIResponse.itemList2);
ClearCollect(itemList3Options, gblAPIResponse.itemList3);

 

Cheers,

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Wow. I swear I tried that before and it didn't work but I'm realizing now it's because this was when I didn't know I had to provide a strict schema to my custom connector for my PowerApp to recognize nested objects in the response. This makes perfect sense and saves me a bunch of separate API calls. Thanks!

Glad I could help!

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,387)