Remove Newline from String?

  • 9 March 2015
  • 4 replies
  • 211 views

Badge +5

Hi,

 

I have a memo field in my smartform. The user enters a value into the text area and in my workflow I use a subset of this string (first 25 characters) in the subject line of an email. If a user enters a newline in the text area the workflow will fail due to the newline " The specified string is not in the form required for a subject"

 

I have tried using the Trim function in both the smartform and the workflow itself to remove the new line however it hasn't done anything. I can't find any other function that would do this for me.

 

Does anyone have any suggestions?

 

Regards,

Ciara


4 replies

Badge +10

Hi,

 

There is a "undocumented" special character that is used for line breaks.

In an expression search for the the text "&#10" inside your text box and replace it with a space or empty string.

This should remove all the line breaks.

 

I hope this helps!

Regards,

JohanL

Badge +5

Hi JohanL,

 

Thanks for the tip!

 

The expression is actually 


 

I had to add it as a data label to my form and and search for the data label in the text area. It wouldn't work if I just searched for 
. I also had to do the replace on the form and not the workflow as I couldn't get it working using the expression editor there.

 

Thanks again.

 

Cheers,
Ciara

Hi Ciara,

 

I tried to do the same but I am not able to figure it out. I have added data label and did a transfer data and assigned the values to data label. and then did a replace also on the data label.

your help will b highly appreciated.

 

Thanks

Neeraj Srivastava

Badge +1

Well 8 years later… But I found a way to do this that actually works reliably in K2 Five. 

 

(You don’t need the Trim if you don’t want it.)

Reply