Forum Discussion

Frontman's avatar
Qrew Trainee
2 months ago

Join multi-line text field to one line

Hi all. I'm trying to find a way (either using a formula or in Pipelines) to join a multi-line text field to a single line.

Use case: The multi-line text field will contain text that will go to the JSON request body of an API call in Pipelines, so the field needs to be converted to a single line. The field has to a multi-line text field, because values can contain several paragraphs and app users can easily customize it.


4 Replies

  • I'm no JSON expert but I know native Quickbase.  Can you provide an example of what the data now looks like and what it needs to look like?

    • Frontman's avatar
      Qrew Trainee

      It could be any string that has multiple line breaks/spaces, and I need it to be converted into a single line without any line breaks. For example


      Convert to

      "blue green yellow"

      • PrashantMaheshw's avatar
        Qrew Captain

        line breaks are identified as \n . So you need to use jinja to replace \n with ' '.

        from QuickBase page 

        Return a copy of the value with all occurrences of a substring replaced with a new one. The first argument is the substring that should be replaced, the second is the replacement string. If the optional third argument count is given, only the first count occurrences are replaced:

        {{ "Hello\nWorld"|replace("\n", "") }}
        output: Goodbye World

        {{ a.myfield | replace('\n', '') }}