Power Automate - Condition not evaluating array name

Options

Hi,

This is my first post so please let me know if this needs to be structured differently.
I have created an automated cloud flow which takes inputs from an MS Form before creating the Name and Value of the inputs into an array. I assess each of the array items in an apply to each loop and if the condition is true, then the value of the array item is written to an excel workbook.

The first item in my array has a Name of Requestor Name and a value which is the MS Form input. I've created a compose to bring back only the Name from the array, which shows in the outputs as Requestor Name. When my condition looks at the output of the compose and assesses whether this is equal to Requestor Name, the result is false. Please help.

900fb4cffc3d639527645cbe9009e5f2-huge-fl

Comments

  • @Dave Wright

    It looks like you posted this in the wrong forum; however the issue is on your Condition, you've hardcoded the word “Requestor Name” instead of using a variable value from the MS Form.

    Thus, it's trying to compare the value of your Compose Output literally to “Requester Name”.

  • @Dave Wright discussion moved to SKY Developer community. Thanks!

  • Alex Wong
    Alex Wong ✭✭✭✭✭
    Ninth Anniversary Facilitator 4 Name Dropper Photogenic

    @Dave Wright
    to know if your flow is structured properly or not, going to need to know your business needs / intention of doing this, and what your MS form's question looks like.

    As for the flow itself:

    • your initialize array variable is static array of object with property “name” and “value”. I don't know what you want to achieve with this, are you just testing and planning in the future for this array to be pulled from somewhere else (i.e. sharepoint or excel?)
    • Assuming you are trying to compare the MS form input to the array variable's value where name="Requestor Name", then (1) your condition is wrong (2) you don't need apply to each, just use Filter Array
    1. Using Apply to Each
      • Compose_1 is not needed, or if you feel its easy to read, then you need to select the dynamic content of “name” property within the array variable, then replace what I stated on next bullet point as the “left” side of the condition with the Compose_1 dynamic content instead
      • Condition should be (dynamic content of “name” within the array variable = “Requestor Name”) AND (dynamic content of “value” within the array variable = dynamic content of the Get response details answer to the name question from MS form
      • your “TRUE” is not doing what you said neither, your screenshot show Update a row, but you said on your post you want to add to excel, so change this if you are trying to Add a row instead.
    2. Using Filter Array
      1. After your Initialize variable action, don't need the Apply to each or anything within it, instead use Filter array action, and provide the array variable as the input and condition on “name” dynamic content = “Requestor Name” AND “value” dynamic content = MS Form response, this does require you to use “Advance” mode so it's a littl harder, but more efficient
      2. Then condition on the “lenght()” of the filter array, if 0 = NOT FOUND, otherwise, at least one is found and do your excel action

Categories