I am trying to reference two fields and if neither have data then default to a third field

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
I am trying to reference two fields and if neither have data then default to a third field.  if( not null([category override] default to [category override].  if(notnull([category entered] default to [category entered] if either of the previous fields has any data then I need that in this field.  If not the formula needs to reference [category patient ID]   Thanks for all your help!!
Photo of Jake

Jake

  • 130 Points 100 badge 2x thumb

Posted 2 years ago

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

QuickBaseCoach App Dev./Training, Champion

  • 65,096 Points 50k badge 2x thumb
no problem.  I assume that these are all actually numeric fields and that this is what you actually meant.  I think you said it backwards.



IF(

[category override] > 0, [category override],  // try this first


[category entered] >0, [category entered],  // else this


[category patient ID] )  // last resort, this
Photo of Jake

Jake

  • 130 Points 100 badge 2x thumb
Mark, thanks for your quick response.  I actually am trying to reference text fields.  How does this change your formula?..  Thanks,
Photo of Jake

Jake

  • 130 Points 100 badge 2x thumb
I know this formula is a little tricky.  If text is in [category override] that should be default; if nothing in [category override] then [category entered] should be default if it has any text in the field; if nothing then it should reference [category patient ID]
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 65,096 Points 50k badge 2x thumb
OK, try this version
IF(
trim([category override]) <>"", [category override],  // try this first

trim([category entered]) <>"", [category entered],  // else this

[category patient ID] )  // last resort, this