Forum Discussion

Vroomkiwi's avatar
Vroomkiwi
Copper Contributor
Jun 23, 2023

Power automate split variables into array output issue

Hi all, 

I'm still newish to Power Automate and am having an issue with a flow's output.

The form question being pulled from is multiple choice, so I want it to show as individual selected items in the Sharepoint register column, but I am getting responses mixed with extra characters like quotation marks, brackets, and commas.  It looks like it's coming from the splitting of the outputs, but I am not sure how to fix it.

 

In my flow, I have this set up before the apply to each:

The formula in the Compose - format Injury is:

replace(replace(replace(body('Get_response_details')?['r63287d6142274127b7724d6ff63f2ac8'],']',''),'[',''),'"','')

 

When testing the flow, this is the output I get from a random selection of choices I used for testing:

 

The formula in the Compose- split format Injury into an array is: split(outputs('Compose_-_format_Injury'),',')

 

When testing the flow, this is the output data from the split:

 

and my Apply to each has the output from the split:

with the test of the flow showing for one of the 3 variables:

 

This is the returned result that pushes to the Sharepoint register:  

 

Where is it going wrong?

 

 

  • Hi Vroomkiwi 

    i am not sure what exactly you mean by "SharePoint register column".

    But i think your variable "varInjury" needs to be of type "string", not "array" and you should use the "Append to string variable" action instead of the "Append to array variable" action.

    Then you can pass a string that looks like this "Strain/sprain;#Dislocation;#Burn/scald" to your register.
    Right now you are likely passing an array that gets serialized to  ["Strain/sprain;#","Dislocation;#","Burn/scald;#"] and that looks like the problem.

    Best Regards,
    Sven

    PS:
    You don't need that loop and the "varInjury" variable.
    You are already using the "split" function to split your string into an array by the delimiter "," .

    Then you can use the "join" function to join that array back to a string using the delimiter ";#"

    join(split(outputs('Compose_-_format_Injury'),','),';#')




  • SvenSieverding's avatar
    SvenSieverding
    Bronze Contributor

    Hi Vroomkiwi 

    i am not sure what exactly you mean by "SharePoint register column".

    But i think your variable "varInjury" needs to be of type "string", not "array" and you should use the "Append to string variable" action instead of the "Append to array variable" action.

    Then you can pass a string that looks like this "Strain/sprain;#Dislocation;#Burn/scald" to your register.
    Right now you are likely passing an array that gets serialized to  ["Strain/sprain;#","Dislocation;#","Burn/scald;#"] and that looks like the problem.

    Best Regards,
    Sven

    PS:
    You don't need that loop and the "varInjury" variable.
    You are already using the "split" function to split your string into an array by the delimiter "," .

    Then you can use the "join" function to join that array back to a string using the delimiter ";#"

    join(split(outputs('Compose_-_format_Injury'),','),';#')




    • Vroomkiwi's avatar
      Vroomkiwi
      Copper Contributor

      SvenSieverding, thank you!!

       

      I had only been taught to do the variables as an array, but changing it to a string was so much easier.

       

      The flow now works properly, and when it pushes to the Sharepoint List, the destination column now shows each individual selection:

       

      Thank you for taking the time to assist me with this and teach me something new!

       

Resources