Carriage Return

Display line breaks in your Mendix strings

Display line breaks in your Mendix strings

I was asked the following question recently:


Do you know if it is possible to use a new-line character when creating an attribute in Mendix?  I've created an attribute that I would like to display as such:
Attribute Name
Entry 1
Entry 2
Entry 3
...
Where each Entry is generated via a loop.  I've tried every new-line character combination and trick I know and can find on the internet ( '\n', '\\n', 'newline', hard coding the return, hard coding the return with a character in the first and last slot, hard coding spaces, etc.).  All of the questions about this topic that I've run into on the Mendix forums have claimed that '\n' or '\\n' work but these do not work for me.  I ran into one question on the forums (whichI can't seem to find now) where someone asked the exact question I have and also said that none of the answers he received worked.
 

The good news is that I can help. I, too, struggled with this topic early on in my Mendix development. I'm sure I read many of the same forum posts this individual did as well as I recognize the proposed solutions. Here's how I deal with line breaks in my Mendix strings.