Linebreak in workflow variable

  • 20 October 2020
  • 4 replies
  • 405 views

Any hints on how I can add a line break in a workflow variable?  

 

In essence, I’m using workflow to send a text message using an API, and I’d like to put a line break in between a couple of the data elements.  For some reason, I thought there was a line break you could drag up from the TEXT operators, but now I’m not seeing it.  

 

Anyway, any help is always appreciated.

 


4 replies

Badge +6

can you use URL Decode function to convert to line-break?

Cr → %0D (ascii 13, carriage return)

Lf → %0A  (ascii 10, line feed)

CrLf → %0D%0A   (line-break)

https://help.k2.com/onlinehelp/k2five/userguide/current/default.htm#LegacyDesigntools/K2_for_VisualStudio_K2_Studio/4.Workflow/InlineFunctions/FB_Text.htm

Hi @rob_n,

 

I know you can use the join function to insert line breaks between SmartObject data lists:

Search for “Join”  in the function “Function” tab
Configure the “Join” function, this will take your SMO Data and put each record on a new line

Im not sure how this will work on a text message, but I used it in an email and it works fine.

Im not sure how you would implement it in your scenario, if this isnt helpful can you explain what your data elements are/what they need to do if possible. Screenshots will also be helpful.

 

Kind Regards

Prineel

I tried the URL Encode and it didn’t seem to work.  I could have been doing it wrong.  I’ll try @Prineel ‘s idea when I get a moment today.

 

Thanks to you both!

 

Rob

 

 

Badge +6

If out-of-the-box function can’t do the job,  It’s always possible to create advanced smartobject (SQL Server store procedure), you pass the value to stored procedure, do the necessary logic and return as select statement (  smartobjects with List method).

 

Example Stored Procedure

 

CREATE PROCEDURE CONVERTCRLF (@INPUT NVARCHAR(MAX)='',@CRLFTAG NVARCHAR(50)='')
AS
BEGIN
    DECLARE @RESULT AS TABLE (OUTPUT NVARCHAR(MAX))
    
    INSERT INTO @RESULT(OUTPUT)
    SELECT REPLACE(@INPUT, @CRLFTAG, (CHAR(13)+CHAR(10)));

    SELECT * FROM @RESULT
END

 

 

 

Test :

EXEC CONVERTCRLF 'LINE1<BR>LINE2<BR>LINE3','<BR>

Output :

 
   OUTPUT
1

LINE1

LINE2

LINE3

 

You can generate smartobject for the above stored procedure, Smartobject Tester will generate method List for CONVERTCRLF

 

You can place <BR> in your messages and  use CONVERTCRLF smartobject to convert to CrLf and send the output directly to API. ( do not store in workflow variable)

 

Reply