web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Display Data from mult...
Power Apps
Answered

Display Data from multi level collection

(0) ShareShare
ReportReport
Posted on by 9

I have created a collection based on a json flow response that has created a multi level collection. I am looking for help in trying to access data nested 3 levels deep in the collection. For instance I have a collection called colFaceData > responses > webDetection > bestGuessLabels > label

 

I am trying to access the value in label. I have attached the schema, and example response, and a screenshot of my collection.

 

How would I first assign a gallery to the bestGuessLabels collection and then assign the text value of a label control with the "label" value?

Categories:
I have the same question (0)
  • Verified answer
    v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @spyderbuilt,

     

    Just from the output data, the Gallery items property should be set to:

    First(first(ColFaceData).Response).webDetection.bestGuessLabels

    Then under the Text property of the Label control, set to:

    ThisItem.Label

    Let me know if this works.

     

    Regards,

    Michael

  • spyderbuilt Profile Picture
    9 on at

    Sorry for the late response but that worked great. I thought I would be limited by the collection being too deep.

     

    Thank you!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-micsh-msft , 
    How can I display this type of thing for a DropDown Control? 
    Schema of API call:

    {
     "type": "object",
     "properties": {
     "features": {
     "type": "array",
     "items": {
     "type": "object",
     "properties": {
     "attributes": {
     "type": "object",
     "properties": {
     "OBJECTID": {
     "type": "integer"
     },
     "OPERATION_NAME": {
     "type": "string"
     },
     "REGION_NAME": {
     "type": "string"
     },
     "LOCATION_NAME": {
     "type": "string"
     }
     }
     }
     },
     "required": [
     "attributes"
     ]
     }
     }
     }
    }

    Collection: colV2Flow.features.attributes (digging into the response a layer)

    Goal:  To have all LOCATION_NAME's available in a DropDown Control

    DropDown.Items tried so far:

    • `collectionName.attributes`
      • Result: Error
      • image.png
    • `First(colV2FLOW.attributes).attributes`
      • Result: Only brings back the first LOCATION_NAME
    • `Ungroup(colV2FLOW), "LOCATION_NAME")`
      • Result: " The specified column "LOCATION_NAME" does not exist."

    I want to control this within PowerApps to keep things simple. Do not want to use Flow if possible. Any ideas @RandyHayes and @v-xida-msft ?

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @ericonline 

    I'm not sure if you are trying to get a table of LOCATION_NAME values that might be in that property, or if you are trying to get all LOCATION_NAME values across all possible results.

     

    One quick action for that structure having multiple records would be a formula such as this:

    ClearCollect(locations, 
     ForAll(yourCollection.properties, properties.features.items.properties.attributes.properties.LOCATION_NAME))

    Again, not sure of your final data and what might be in it, but in this sample, we're collecting all the location names into a collection.

     

    Hope that give some guidance.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Bro... you are batting 1000 today! Thank you so much, sincerely. You rock man!
    Went with:

    ClearCollect(
     colLocations, 
     ForAll(
     collectionName.attributes, 
     attributes.LOCATION_NAME
     )
    )

    Dropdown:

    Distinct(colLocations.Value, Value)

    !

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Adding to the Body of Knowledge here... I couldn't figure out how to use the above to grab 2 or more attributes. 

    Tried:

    ClearCollect(
     colLocations, 
     ForAll(
     collectionName.attributes, 
     attributes.LOCATION_NAME && attributes: THING1_NAME
     )
    )

    Had to rearrange things a bit to:

    ForAll(
     collectionName.attributes, 
     Collect(
     colLocationsAndThing1,
     {
     location: attributes.LOCATION_NAME,
     thing1: attributes.THING1_NAME
     }
     )
    )

    This worked well! Thanks again

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @ericonline 

    I think your first try was closer...

     

    ClearCollect(
     colLocations, 
     ForAll(
     collectionName.attributes, 
     {location: attributes.LOCATION_NAME,
    thing1: attributes.THING1_NAME
    } ) )

    If not closer...just a little easier on the eyes perhaps...

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Interesting! I've not experimented with ForAll very much. 
    These both return the same tables:

    ForAll(
     collectionName.attributes, 
     Collect(
     colLocationsAndThing1,
     {
     location: attributes.LOCATION_NAME, 
     thing1: attributes.THING1_NAME
     }
     )
    );
    
    ClearCollect(
     colLocationsAndThing1_TEST,
     ForAll(
     collectionName.attributes,
     {
     location: attributes.LOCATION_NAME,
     thing1: attributes.THING1_NAME
     }
     )
    )
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @ericonline 

    Yes, thing to note...ForAll returns a collection (or a table of records)!

    So, in the first one, you are iterating over collectionName.attributes and for each one, you are Collecting a record in the colLocationsAndThing1 collection.

    In the second one, you are iterating over the collectionName.attributes again, but this time ForAll is building a table of records, that table of records then gets assigned (collected) to the colLocationsAndThing1_Test collection.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @ericonline 

    Just as a little example...

    //Simple ForAll
    CountRows(ForAll([1,2,3,4,5], Value)) = 5
    First(ForAll([1,2,3,4,5], Value)).Value = 1
    Last(ForAll([1,2,3,4,5], Value)).Value = 5
    //ForAll to make records
    CountRows(ForAll([1,2,3,4,5], {myVal:Value})) = 5
    First(ForAll([1,2,3,4,5], {myVal:Value})).myVal = 1
    //A little more structure
    Last(
    First(
    ForAll([1,2,3,4,5],
    {myVal:Value,
    myTab:ForAll([10,20,30,40], Value)
    }
    )
    ).myTab).Value = 40

    They're not all that complex to deal with, but one must remember...there are not For Next loops!!  They are data iterations.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard