If I store a value such as abc\nefg and then echo it, I have :
abc
def
If I store the same value from a CSV file and then echo it, I have : abc\ndef, so escape character does not work.
I tried to tricky it, store the csv value in a variable then in another. I insert the string between quotes in the csv file. I doubled escaped. But I found no solution.
The problem is not only “echo”. But I tried to TYPE a value and when I record and replay it works like a charm and record abc\ndef and enter abc (line feed) def when it plays. I would like to avoid a complex routine look for \n in the string and then use SendKey ou XType for the carriage return…
Here is the code to test (testcsv.csv has the abc\ndef value) :
I don’t create the csv file inside the ui.vision RPA. I use the hard drive location (datasources) where I saved a csv created with notepad++. The testcsv.csv is very simple :
And the result is :
I managed the problem with Xclick where I replace all \n occurrence, but it would be nice if the solution with TYPE worked.
I confirmed that this is indeed a bug. If the CSV file is read, the abc\ndef string is imported as abc\\ndef (so two \ instead of one). => We will fix this asap.
Workaround: Replace each \\n with \n. You can do this with a regular expression: var str = ${t1}; return str.replace(/\\n/g,"\n");
Development does not think it’s a bug: If you have “abc\ndef” in csv, it’s actually just literally “\n” instead of line break. Check out my csv attached below:
If we change it, it might break other use cases. So we will leave it as it is at the moment, especially since there is a good workaround for your use case.