Hello,
I have an Adaptive Card that returns to me a submitted response that includes all dynamic responses in a single object.
Those dynamic inputs have an id assigned - this id is the key containing the value I want assigned to it.
{
"body": {
"5caf4a2f-b16b-eb11-a812-000d3a987ca7": "Value1",
"fc02e508-b26b-eb11-a812-000d3a987ca7": "Value2"
}
}
I have a separate array to compare the object against:
{
"ids": [
{
"id": "5caf4a2f-b16b-eb11-a812-000d3a987ca7"
},
{
"id": "fc02e508-b26b-eb11-a812-000d3a987ca7"
}
]
}
In the end, I want to be able to transform the data to below:
{
"data": [
{
"id": "5caf4a2f-b16b-eb11-a812-000d3a987ca7",
"value": "Value1"
},
{
"id": "fc02e508-b26b-eb11-a812-000d3a987ca7",
"value": "Value2"
}
]
}
Question: How would I be able to iterate through the values from the array of id's and select the values from an object using those ids as the key?
Solved! Go to Solution.
Hi @virakones
The following flow is for your reference:
The inputs for all the ‘compose’ actions are:
Compose:
{
"ids": [
{
"id": "5caf4a2f-b16b-eb11-a812-000d3a987ca7"
},
{
"id": "fc02e508-b26b-eb11-a812-000d3a987ca7"
}
]
}
Compose 3:
outputs('Compose')?['ids']
Compose 2:
{
"body": {
"5caf4a2f-b16b-eb11-a812-000d3a987ca7": "Value1",
"fc02e508-b26b-eb11-a812-000d3a987ca7": "Value2"
}
}
Compose 5:
outputs('Compose_2')?['body']
Compose 4:
outputs('Compose_5')[items('Apply_to_each')?['id']]
Compose 6:
{
"id": "@{items('Apply_to_each')?['id']}",
"value": @{outputs('Compose_4')}
}
Best Regards,
Community Support Team _ Kira Xie
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @virakones
The following flow is for your reference:
The inputs for all the ‘compose’ actions are:
Compose:
{
"ids": [
{
"id": "5caf4a2f-b16b-eb11-a812-000d3a987ca7"
},
{
"id": "fc02e508-b26b-eb11-a812-000d3a987ca7"
}
]
}
Compose 3:
outputs('Compose')?['ids']
Compose 2:
{
"body": {
"5caf4a2f-b16b-eb11-a812-000d3a987ca7": "Value1",
"fc02e508-b26b-eb11-a812-000d3a987ca7": "Value2"
}
}
Compose 5:
outputs('Compose_2')?['body']
Compose 4:
outputs('Compose_5')[items('Apply_to_each')?['id']]
Compose 6:
{
"id": "@{items('Apply_to_each')?['id']}",
"value": @{outputs('Compose_4')}
}
Best Regards,
Community Support Team _ Kira Xie
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-yiwenxie-msft
Thank you! This has been bugging me for a while. I appreciate the help - there is no way I would have considered using those compose actions the way you outlined but the end result is fantastic.
@virakones thank you for pointing me in the direction of this thread. This is exactly what I am looking for.
Can you share with me, how you created the separate array with the IDs to compare against?
Nevermind, I got it working. I always thought it would be possible somehow, but I would never have come up with that solution myself.
Thanks both of you, @virakones @v-yiwenxie-msft
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Read the latest about new experiences and capabilities in the Power Automate product blog.
User | Count |
---|---|
25 | |
25 | |
25 | |
21 | |
15 |
User | Count |
---|---|
51 | |
45 | |
35 | |
31 | |
30 |