Line Feed in Text Area Control


Badge

Hi,

 

I am using a data label with the Text property set to &#10 and the Literal property set to true to assemble an address out of separate address parts.

The data label is named CarriageReturnDataLabel​.

 

In a Transfer Data action then, I assign [FullName ] [Street​] [CarriageReturnDataLabel​] [City]​ [CarriageReturnDataLabel​] [Country]  to a Text Area control.

 

The Literal property is not honored, i.e. as a result I am getting something similar to:

Paula Mayer&#10Berliner Str. 1&#10Berlin&#10Germany

 

Until version 4.6.8 the Text Area control used to show line feeds between the address parts.

With version 4.6.9 I get the textual representation from above.

 

Any idea?

 

Thank you

Marcel


2 replies

Userlevel 5
Badge +16

Hi Marcel,


I would suggest that you create an expression to concatenate you address parts however you want and then transfer the expression to the text area.


I personally use the <br> tag im my expressions to give new line, try to use it in your text area


wish it helps

Userlevel 1
Badge +4

Marcel,

First, this is a kind of a rediculous solution, but is one way that we just started using to get around this and other similar problems.

We experience the same issue and really started with the TextAreas, but we also saw it when we were doing thing with expressions to replace certain characters so I have found this to be more of a wide spread change.

 

Ok, so the real question is how do we get a honest unencoded new-line character into the smart form.  We faced this problem with several other characters and other contstants that we wanted to use in Smartforms but didn't want to specify them in each form.  Our way was to make a Smart Object that would return us the character in question.  In our case we used a custom .Net assembly that exposed these using a function GetChar method.   That is certainly a complex solution, but has the benifit that it is "local" to the K2 server so the speed of the SmartObject call is about as fast as we can make it.  An alternative as a proof of concept is to use the Smartbox to store the newline character in a text field then retrive that into your [NewLineDataLabel].

 

So lets look at the whole solution (again kind of rediculous):

Create a new SmartBox smart object that has only two columns, ID, CharValue (string).  Using SQL Server add at least 10 rows to that table.  Then use the following update statement to set the "CharValue" column (note, replace the table and column names as appropriate.

UPDATE [dbo].CharValueSMO SET CharValue = CHAR(ID)

This will set the CharValue colum to the character value of the ID column.  Now you will have a SmartObject that you can use to lookup and character value by doing a Read on the SMO and using the CharValue property.

 

Then back in your smartform, instead of setting the Text Property of your data label to "&#10;", use a SmartObject call to load the data from ID = 10.

Then the rest of your code will work with no changes.

 

Again, finaly warning, this is rediculous but will solve the problem with minimal changes and only minor performance impact.  If you do find yourself doing this all over the place or needing other "constants" then I would suggest using a .Net assembly for speed.  Here is our code that we use so you can see how simple this is in a .Net assembly:

 

public static string GetCharacter(int charCode)
{

return ((char)charCode).ToString();

}

 

Hope that helps.

 

 

Reply