Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Append string values generated per iteration without append variable or array variable

I have ADF pipeline Which have parameter set multiple comma separated values to it. I have for each loop which iterates over these parameter values and set variable activity inside for each loop using String type variable named "dynamicbody" which generates different string values per iteration accepting different parameter value each time.

Next I need to append these iteration outputs of first set variable activity for which I used append variable activity which uses array type of variable to append values. Now the thing is we use terraform to deploy ADF pipelines and array variable is not supported in terraform to deploy.

So, I want to append these string values generated by first set variable activity per iteration without using append variable activity and without using array type variable. How to achieve this? Can we use another set variable activity to append values using string type variable?(I tried same but not succeeded). Any other way to do this?

Please help if anyone knowshow to achieve the same.

I tried using another set variable activity using string type variable to concatenate first set variable activitiy's each iteration output. I used concat function but it did't worked when I run pipeline it holds only last iteration value.

I want all iterations values to be appended in single string type variable only.

like image 268
Rahi Jangle Avatar asked Mar 03 '26 05:03

Rahi Jangle


1 Answers

I agree with @Nandan, if you want to append strings without append variable activity, you need to use two string variables res_str and temp_str. Create those like below.

enter image description here

One variable will be used as substitute for another, because self-referencing variables like a=a+b is not allowed in ADF.

Give your array to ForEach and make sure you check on Sequential checkbox. I have taken the array like this ["Rakesh,Laddu","Virat,John","Starc,Scofield","Kick,Gunther"].

enter image description here

Inside ForEach, take two set variable activities. Assign res_str variable to temp_str variable like below.

enter image description here

For the first iteration, this value will be empty string "". Now, in another activity, concat the temp_str variable and current item() like below.

@concat(variables('temp_str'),item())

enter image description here

You can add separators between them as per your requirement, but the separator will append at the start of the result string as well.

Debug the pipeline and it will the expected result string after the loop like below.

enter image description here

like image 67
Rakesh Govindula Avatar answered Mar 05 '26 18:03

Rakesh Govindula



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!