Solved

Issues adding empty line to end of text variable

  • 19 October 2022
  • 2 replies
  • 199 views

Userlevel 4
Badge +10

I'm having issues adding a blank line to the end of a text variable. It seems like NWC is trimming my variables automatically, causing blank lines to be dropped off.  I can go into detail on why I'm needing this if needed.

 

My current approach is to use a "Create a text string" action, setup like this:

26805i6F3E870AFF34241E.png

 

I use this "Log to instance details" action to verify the output:

26806iE70CAD1EDCE8EDD9.png

 

 

When using the workflow testing feature, I get this output, which is exactly what I want! (blank line after the c in the second set):

26807i02DEA1925A02D5D9.png

 

Unfortunately, once published, it results in this output (No blank line):

26808i4BCFB23CA0C7D635.png

 

 

Does anyone have any suggestions as to how I can get a blank line at the end of a text variable without NWC trimming it off? These variables are coming from a form (long text, plain), so if there's something to be done there that is an option as well. 

 

Thank you!

icon

Best answer by bsikes 20 October 2022, 20:57

View original

2 replies

Userlevel 4
Badge +12

Hi @bsikes,


How about trying a 'Apply a regular expression' action and do a replacement for pattern being end of string before a new line and with replacement text of
for new line?


 


Cheers,
Gavin

Userlevel 4
Badge +10

Thanks for the response @Gavin-Adams 


 


I tried that, but it seems like when doing an "Apply a regular expression" action, it interprets the
as literal instead of a new line, resulting in:


a


b


c


 


But, this did lead me to the solution I needed!


 


Since my solution is not exactly in line with my original question, I'll explain my problem in more detail. I'm using a Doc Gen action with an excel file. A few of the fields that are merged onto the excel file are setup to wrap-text and auto-adjust height as needed. Sometimes, this can result in the lower portion of the final line being cut off once generated:



 


The solution I was trying to arrive at was to add a blank line at the end of the variable being merged, to essentially have some padding at the bottom to prevent actual text from getting cut off.  Unfortunately, since Nintex seems to trim text variables automatically (at least in my testing), this kept removing the extra line I needed. My solution, was to add in the extra blank line (or 2) followed by a blank character that Nintex doesn't treat as white space. This prevents the trimming since the new lines are between valid characters, even though the final character is also white space. 


 


In this case, the character I used was a nonbreaking space, entered by using the keys [alt] + [0][1][6][0]. I was able to use Form Variables with the replace function to get the variable formatted as needed for my doc gen action: replace([Form].[Director Add],"$","

 ")



 


 

Reply