append variable

arkiboys 9,556 Reputation points
2022-04-19T13:22:44.547+00:00

1- foreach activity loops through companyNames in a csv file
inside foreach, append variable has
Name --> v_companyname
value --> @item().p_companyName

next is set variable
Name --> v_companynames
value --> @variables('v_companyname')

at present, the output of the set variable is like:
{
"name": "v_companynames",
"value": [
"companyName1",
"companyName2",
"companyName3",
"companyName4"
]
}

Question:
How can I make sure tI build the string like below ?

... and companyNames in ("companyName1","companyName2","companyName3","companyName4")

Thank you

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,487 questions
0 comments No comments
{count} votes

Accepted answer
  1. KranthiPakala-MSFT 46,422 Reputation points Microsoft Employee
    2022-04-20T00:21:00.263+00:00

    Hello @arkiboys ,

    Thanks for the question and using MS Q&A platform.

    Please try using join function. I assume your v_companynames is a variable of array type, inorder to use the join function you will have to change the v_companynames variable to type string instead of type array.

    Your expression may look like - @join(variables('v_companyname'),',') .

    This way you will be able to create a string with a value of your company names.

    Here is a stackoverflow thread where a similar scenario has been discussed: ADF expression to convert array to comma separated string

    Hope this helps. Do let us know how it goes.


0 additional answers

Sort by: Most helpful