Double Quotes around String Variable Problems

I’m trying to output variables to a CSV file with double quotes surrounding each value.

Desired Result:
image

This is my sequence where I try 2 different methods:

in_EmpID = “123”
in_EmpName = “John Doe”

METHOD 1:
vEmpID = Chr(34)+in_EmpID+Chr(34)
vEmpName = Chr(34)+in_EmpName+Chr(34)

METHOD 2:
vEmpID = “”“”+in_EmpID+“”“”
vEmpName = “”“”+in_EmpName+“”“”

Below is the Actual Output in both Excel and Notepad++. The first row corresponds to Method 1 and the 2nd to Method 2.

When I view the CSV via Excel, both methods seem to work as desired:
image

However, when I view the CSV via Notepad (which is where I need it to be correct), it looks like this:
image

Why is it surrounding the values with 3 double quotes instead of only 1 and how do I correct this?

we do opening the string with ", same we close
we escape a " with a double "

so " (opening) “” (Escape + Quote = 2) = 3, same for closing

statement is related to the code e.g.
grafik
\ is visualizing the escape "

So why doesn’t Method 1 work? And do you have a solution?

there is no string so we do not have to open with ", as we are using the method and concatenating with a variable

Method 2 is as explained above: " for opening “” (escape and quote) " for ending the string = 4

So I found where the problem was occurring… seems to be a bug with the Add Data Row activity…

Both methods were working in that the variables were as expected “123” and “John Doe”

But when I went to Add Data Row, the activity was adding the extra double quotes.

Code:

Output:

image

As a workaround, I just used the Append Line activity.

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