Text Formula Help

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

I would like to Concatenate 5 text fields......but only the fields that are not blank. 

Thank you

Photo of George

George

  • 180 Points 100 badge 2x thumb

Posted 3 years ago

  • 0
  • 1
Photo of Tobias

Tobias

  • 20 Points
Try this:

List("_", [field 1], [field 2], [field 3], [field 4], [field 5]) 


It will only pull in values for non-null fields.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 62,316 Points 50k badge 2x thumb
Just to chime in here - the first parameter is the separator between any non blank values, so if you wanted comma separated (ie commas and a space)  it would be

List(", ", [field 1], [field 2], [field 3], [field 4], [field 5])
Photo of Tamara

Tamara

  • 366 Points 250 badge 2x thumb
What if you want to put a word in front of each to separate, but the word would be different depending on the field and the word and it's related text would only appear if the text field contained data?  For instance "Action" if [Action Note] contains text followed by "Timeline" if [Timeline Note] contains text followed by "Requirements" if [Requirement Note] contains text.
Photo of Xavier Fan

Xavier Fan, Champion

  • 340 Points 250 badge 2x thumb
Tamara - then you'd do something like this:

List (", ",

If ([Action Note] <> "", "Action = " & [Action Note]),

If ([Timeline Note] <> "", "Timeline = " & [Timeline Note]),


If ([Requirement Note] <> "", "Requirements = " & [Requirement Note])

)
Photo of Tamara

Tamara

  • 366 Points 250 badge 2x thumb
That worked perfectly!  Thank you so much.
Photo of Xavier Fan

Xavier Fan, Champion

  • 340 Points 250 badge 2x thumb
You're welcome!
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 62,316 Points 50k badge 2x thumb
For example, if you wanted to have a vertical list

List("\n",
IF(Trim([Action Note])<>"", "Action: " & [Action Note]),
IF(Trim([Time Line Note])<>"", "Time Line: " & [Time Line Note]),
IF(Trim([Requirements Note])<>"", "Requirements: " & [Requirements Note]))
Photo of Tamara

Tamara

  • 366 Points 250 badge 2x thumb
Thanks.  Alternatively, I replaced the comma separator with <br> and that gave me a vertical list as well.  Thanks again!
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 62,316 Points 50k badge 2x thumb
Right, if HTML is enabled, then you need to use <br> for a vertical list.