I am using baserow.io and am attempting to make mailing labels for members. I need to insert a newline after the first address line and before the City.
The concatenation shows the literal ‘\n’. Is there a way to do this?
I am using baserow.io and am attempting to make mailing labels for members. I need to insert a newline after the first address line and before the City.
The concatenation shows the literal ‘\n’. Is there a way to do this?
Hey @random,
I have created an issue to fix the confusion caused by the use of newlines in formulas, as some frontend components are not displaying them properly. You can find it here New lines in formula are not shown in the cell (#2197) · Issues · Baserow / baserow · GitLab
In the meantime, you can add newlines in the formula editor by typing Shift+Enter.
For now, you can see that the newlines are visible in the formula editor and in the row modal (the one that is open if you click the spacebar after selecting one cell or if you click the little icon at the beginning of the row.
Hope this helps,
davide
Thanks. I changed the formula as you described and the mailing label field no longer shows the imbedded ‘\n’.
Old formula: concat(field(‘Address_Line_1’),‘\n’,field(‘City’),', ‘,field(‘State’),’ ',field(‘Zipcode’))
Result: 5422 Sideroad Burson Ca 95123 “5422 Sideroad\nBurson, Ca 95123”
New formula: concat(field(‘Address_Line_1’),’
‘,field(‘City’),’, ‘,field(‘State’),’ ',field(‘Zipcode’))
Result: 5422 Sideroad Burson Ca 95123 “5422 Sideroad
Burson, Ca 95123”
Issue resolved.
Shift + Enter, either with or without quotes has no effect on producing a new line.
Mac OSX / Chrome browser
copy your formula-column and than edit that new column to a multiline-column …
While using SHIFT+ENTER in a simple formula such as:
‘a
b’
works just fine, it does not work within a CONCAT string. When using the CONCAT function I found it necessary to enclose the SHIFT+ENTER within parentheses. For example:
concat(field(‘Name’),"
“,field(‘Address’),”
“,field(‘Phone’),”
",field(‘Email’))
This formula worked well for me.
Hey @HandyTravis, I’m not really sure if I follow what is not working, to be honest. Would mind elaborating on what is not working, and what result you expected.
@davide provided a post on Dec of 2023 in this thread which shows how we can use Shift+Enter to create a new line. I confirmed that this method still works in the context of the ultra-simplistic example which he included. However, when I attempted to apply this method to a CONCAT formula, it failed to produce - on it’s own. I was able to create a CONCAT formula that includes new lines by enclosing the Shift+Enter in quotes.
Here is my working formula for creating a contact information block:
concat(field(‘Name’),"
“,field(‘Address’),”
“,field(‘Phone’),”
",field(‘Email’))
I am currently using this field for streamlining the process of creating estimates, proposals, and invoices. The one thing that remains a slight inconvenience is that the result pastes into my documents within quotes that then must be deleted - but that is minor and a different topic.
Thank you for the feedback @HandyTravis.
I agree that managing line breaks is not as simple as it could be, but we are working on a new editor that should improve the user experience in this and many other scenarios involving complex formulas Draft: Advanced Formula Editor UI . There will be some more work needed to replace our current editor, but I thought to share it already.
For now, I added a comment to the issue here to make sure we don’t forget about this: Add support for advanced formulas (#3164) · Issues · Baserow / baserow · GitLab
The one thing that remains a slight inconvenience is that the result pastes into my documents within quotes that then must be deleted - but that is minor and a different topic.
This seems related to New lines in formula are not shown in the cell (#2197) · Issues · Baserow / baserow · GitLab. I added a comment to that issue to make sure this will be checked as well when we’ll work on the issue.