Skip to main content
Question

Converting from multi-line to rich text field without losing line breaks

  • January 30, 2020
  • 0 replies
  • 131 views

I'd like to change the field type of an important field from multi-line to rich text. I have thousands of records with valuable data in this field, and don't want to lose existing line breaks. Despite the suggestion made in this other discussion thread, it doesn't work to simply replace "/n" with "<br>". According to QB Support, some of the line breaks are represented by "\r". And if you try substituting "\r" in a text formula, it breaks.

My intended process would be:
  1. Transform existing multiline data into a new field with <br> tags using a formula like
    If(
       Contains([Description of Service], "\n"),
         SearchAndReplace([Description of Service], "\n", "<br>"),
       Contains([Description of Service], "r"),
         SearchAndReplace([Description of Service], "r", "<br>"),
       [Description of Service]
    )
  2. Export all records in table
  3. Change field type of the original field to rich text
  4. Import data into transformed field
  5. Live happily every after.
Any suggestions on how to accomplish?

------------------------------
Jonathan Heuer
------------------------------
This topic has been closed for replies.

Forum|alt.badge.img+15
  • Quickbase Alumni
  • January 30, 2020
Jonathan,

A QB if statement will escape when it hits the first True condition.  Imagine a record where both are present, this will only get the first one.

I suggest exporting all the records and writing a short PHP script to go through the entire data set and change both.

------------------------------
Don Larson
Paasporter
Westlake OH
------------------------------