Double quote a string variable and concatenate with another string in a datatable

Hello,

I have this csv file

And I need to format the file so it will looks like this below:

The format above will allow me to send the data using an API through a HTTP POST Request. At this point I have completed This:
1: Moving the headers to each row and concatenated them before every string value. Except the first column. It looks like this below:

The next step is to double quote every string value after the equal character starting from Type word to look like this Type=“User” and the issue I have not figure out yet is how to add the double quote. The value “User” comes from a string variable called rowItem3 I previously extracted from my DataTable and saved in order to concatenated with “Type”.

When I add the double quotes to the variable in the assign activity I get this output result:

I have tried using Chr(34), regex replace statement, string replace statement and also, I have looked all the similar issues posted in the forum that I was able to find but none of them fixes my issue.

This is how I have the string concatenate step inside the assign activity

image

It is inside a for each activity so I can have all the DataTable rows updated

If this is fixed I will see the light at the end of the tunnel and proceed removing the first row which will be no longer needed.

Heeeelp haha… I would really appreciate any idea.

To put double quotes inside the value of the string you only need to ‘escape’ them, which is done by using more double quotes.

So the string containing type="Fluffy Bunny" should be:
assign to myString: "type=""Fluffy Bunny"""

So the entire string encapsulated by normal double qoutes, and any double quote character that’s to be part of the value of the string double-double quotes.

1 Like

Sorry for the late response and thank you for your answer, however:

It didn’t work. Part of the string comes from the rowItem3 variable and what I’m trying to double quote is only the variable value not the “type=” which is an static value. I tried also the example you give and it throws this result:

I found a workaround solution. I added two spaces 1 between the string and the variable and 1 at the end of the variable like this “Type=”+" “+rowItem3+” " in the assign activity where I concatenated the string and the variable. Then I used an Output Data Table activity to convert all the data into an output txt file and used an Assign activity again to replace the spaces with the double quote. I hope this helps to some else.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.