How to map value from a collection within an array based on an id within a sub _attribute of that collection?

I am trying to map and use the values from an XMl file that I parsed. There are two values I need

  1. “_value” of “id: skintone”
  2. “_value” of “id: gender”

However, given my xml file, it appears the id is a sub-collection of each of the named values (which are part of the survey1_radio array). So I am confused as to how I can map the value of that field based on the id in question.

Screenshot here of the exact values I need from this XML:

Hi @mattb,

Assuming that the photo_information contains single element provided that it is an array, what you can do is use map function,

What, you want to do is select survey1_radio as the input for the map function and then check if the attribute id value is either skintone, gender or any other values; this will return single result with the desired value if present.

{{map(1.Breeze System Photobooth.photo_information.survey_data.survey1_radio; “_value”; “_attributes.id”; “skintone”)}}

2 Likes

Ah, that’s what I missed. I wasn’t totally clear on how to define the “id” but I see you used dot notation to indicate the attribute parent, followed by id. Thanks this helps!

1 Like