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?
Solved! Go to Solution.
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
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
Sorry for the late response but that worked great. I thought I would be limited by the collection being too deep.
Thank you!
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:
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 ?
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.
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)
!
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
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...
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 } ) )
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.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
User | Count |
---|---|
208 | |
97 | |
60 | |
51 | |
51 |
User | Count |
---|---|
255 | |
158 | |
87 | |
79 | |
61 |