skip to Main Content

I am building an Azure Data Factory. Inside a Data Flow I have an array of strings.

That array of strings I wish to merge into one single string.

ie. [ "value1", "value2" ] into "value1, value2"

Is that even possible, I can´t find any function helping me out here?

I wish there existed a join function or foreach but can’t find any?

3

Answers


  1. You can use the join function which is present in collection functions in Add dynamic content.

    enter image description here

    Syntax:

    join([<collection>], '<delimiter>')
    

    Example:

    join(variables('ARRAY_VARIABLE'), ',')
    

    Refer this to learn more about the Join.

    Also, you can do it by using a ForEach loop activity to iterate over the array and use a Set Variable task with a concat expression function to create the comma separated string.

    In case, you just have two elements in your array, then you can do like this.

    @concat(variables('variable_name')[0].Code1, ',', variables('variable_name')[1].Code1)
    
    Login or Signup to reply.
  2. Does toString(myArray) do what you are looking for?

    Login or Signup to reply.
  3. Here you go:

    dropLeft(toString(reduce(['value1','value2','value3','value4'], '', #acc + ', ' + #item, #result)), 2)
    

    Results:

    value1, value2, value3, value4
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search