Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Saravanan_Desingh
MVP
MVP

Escape \n

I have a situation here. My text has something like below.

\\nabcdefgh

Here '\n' is considered as New-Line and I'm getting the output like below (split of line).

\

abcdefgh


Is there any work around? How to escape '\n' here?

Please advise.


Labels (1)
4 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

What will data like this be used for? If it's allowed to add a single space between the last backslash and the 'n' character, you could break the C-like interpretation of special characters. Like in:

=Replace('\\nabcdefgh', '\n', '\ n')

And note that this translation only happens at the display stage, not while manipulating data in fields.

Best,

Peter

Saravanan_Desingh
MVP
MVP
Author

Thanks, Peter. This is helpful.

It's just a text object to display some information. So, this should work.

jagan
Partner - Champion III
Partner - Champion III

Hi,

You can replace it by using Replace() like below

=Replace('\\nabcdefgh', '\n', '')

You can do this in script like below

LOAD

Replace(FieldName, '\n', '') AS FieldName,

,

,

,

FROM DataSource;


Hope this helps you.


Regards,

Jagan.

jagan
Partner - Champion III
Partner - Champion III

Hi,

If you got the answer close this thread by giving Correct and Helpful answers to the posts which helps you.

Regards,

Jagan.