How do I set an "If" condition for text formula in which I make the formula depend on if another text field is empty?

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

I have 2 text fields for emails, [Email] and newer [Email Formula.]  One was the original, and the second is a new text formula shortcut to input emails.  To resolve this and make it easier to find emails, I've created another text formula field, which I want to set to fill with whichever of the first two email fields isn't empty.  Yet the IsNull doesn't work with text formulas.  I tried- "[If IsNull Email], [Email Formula], [Email])" but that won't work because an empty text field never reads as Null.  So how do I get this to work?

Photo of Dan

Dan

  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
Try this

IF(not Trim([Email]<>"", Trim([Email]),  [Email Formula])




The IsNull will not work for text fields, and i am assuming that an email field is treated as a text field.  I use Trim(  ) just in case the email field was enter as a space(s).
Photo of Dan

Dan

  • 0 Points
Looks like there's some kind of syntax error there in the formula.  What might it be?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
sorry
IF(Trim([Email]<>"", Trim([Email]),  [Email Formula])
Photo of Dan

Dan

  • 0 Points
Sorry that's still not working.  If the field is just empty, then what will the trim function do?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
I was missing a closing bracket

IF(Trim([Email])<>"", Trim([Email]),  [Email Formula])

if the field is empty it will use the [Email formula] field
Photo of Dan

Dan

  • 0 Points
Thanks Mark! That worked!
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,542 Points 50k badge 2x thumb
OK great, thx for letting me know.