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 Automate / Need Help with Compari...
Power Automate
Answered

Need Help with Comparing Microsoft Forms Responses to JSON Array (key value)

(0) ShareShare
ReportReport
Posted on by 7
Hello, I need some help. 
 
My flow starts with the Trigger "When a new response is submitted", because I'm using Microsoft Forms. After that, it has an action called "Get response items". 
 
Then I Initialize a variable called "pregunta" (a string) that saves an answer from the Forms.

 

Captura de pantalla 2023-10-16 163411.png

The thing is, this answer can be 6 options, Option A to Option F (these are just examples, names are in Spanish). 
Each Option is assigned to a number, so: Option A = 1, Option B = 2, Option C = 3, and so on. 
 
(variable "numeroPregunta is 10, just because, to initialize it) 
 
Captura de pantalla 2023-10-16 163826.png

Chat GPT gave me this code for the Compose Action. 

if(equals(variables('pregunta'),variables('jsonPreguntas').jsonPregunta),variables('jsonPreguntas').jsonNumeroPregunta)

 

But it's not working.

 

Do you know how I can do this? 


Variable = "Cat" 


[

{"pet": "dog",

"color": "black"},

{"pet": "cat",

"color": "orange"},

"pet": "mouse",

"color": "white"}

]

 

new Variable = orange

I need to obtain the other parameters that match with my variable. 

Maybe I'm not using the json array correctly or something. 

Please, I would appreciate your help! 

Categories:
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @javieracortes04 ,

     

    I've made a test for your reference:

    1\The Form

    vbofengmsft_1-1697506085417.png

    2\My flow

    vbofengmsft_0-1697506001897.png

    3\Result

    vbofengmsft_2-1697506140035.png

     

    Best Regards,

    Bof

  • javieracortes04 Profile Picture
    7 on at

    First of all, thank you. 

    But I think I didn't explain myself so well. So sorry! 

     

    I need to "transform" the answer to an equivalent index. If the answer was Cat, then I need the variable set to 1. If the answer is Dog then variable = 2, and so on. 

     

    I need to do this with 2 questions, the first one has 6 options, but the second one has 41 options, so I hope the answer to my problem is not booleans or parallel branches.  


    image.png

     

    Best regards, 

    Javiera

  • Verified answer
    Chriddle Profile Picture
    8,729 Super User 2026 Season 2 on at

    These transformations can bedone with simple objects.

     

    Here an example flow where the trigger input is transformed to the according number:

    Chriddle_1-1697641117167.png

    "Test" Input:

    outputs('Transformation')[triggerBody()['text']]

     

     

    The flow run looks like this:

    Chriddle_0-1697641040002.png

     

  • javieracortes04 Profile Picture
    7 on at

    It did work! 

    Thank you so much! 

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

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 426

#2
11manish Profile Picture

11manish 349 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard