4

I have two variables as Arrays in Logic app Ex;

 Variable A=["A","B"]
    Variable B=["C","D"]

I want to combine both and return

 Variable 9=["A","B","C","D"]
dreftymac
  • 31,404
  • 26
  • 119
  • 182
prasy
  • 81
  • 1
  • 5

1 Answers1

6

Use the union function to combine two arrays:

union(variables('arr1'), variables('arr2'))

EDIT - add version to retain duplicates:

This will produce an array that removes duplicate entries. To retain the duplicates, use the join function to convert the arrays to strings:

join(variables('arr1'),',')

Next use concat to create a single string:

concat(variables('arr1String'),',',variables('arr2String'))

Finally, use split to convert the concatenated string to an array:

split(variables('arrStringsConcat'),',')

It gets pretty messy, but all together as a single statement:

split(concat(join(variables('arr1'),','),',',join(variables('arr2'),',')),',')
Joel Cochran
  • 7,139
  • 2
  • 30
  • 43