test for string checkbox

  • 0
  • 1
  • Question
  • Updated 6 months ago
  • Answered
If([Accounting Solution]=Left("QB Online", 9), true)

Why doesn't this formula check the box in a Formula Checkbox field?  [Accounting Solution] is multiple choice text field containing entries such as:  QB Online Essentials, QB Online Plus, etc.
Photo of Roth

Roth

  • 30 Points

Posted 6 months ago

  • 0
  • 1
Photo of Chris

Chris, Champion

  • 4,390 Points 4k badge 2x thumb

YOu have not finished the formula:

If([Accounting Solution]=Left("QB Online", 9),true,false)

(Edited)
Photo of Dan

Dan

  • 1,176 Points 1k badge 2x thumb
If you want the box to be checked if the value in the Accounting Solution field is "QB Online", this should work:
If([Accounting Solution]="QB Online", true)
Photo of Chris

Chris, Champion

  • 4,390 Points 4k badge 2x thumb

if(

left([Accounting Solution],9)="QB Online",true,false)

Right, you probably don't need the 9.

(Edited)
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,322 Points 20k badge 2x thumb
You probably don't need the If(). Try this:

[Accounting Solution] = "QB Online"
Photo of Chris

Chris, Champion

  • 4,390 Points 4k badge 2x thumb
That's what I was going to suggest but it's not intuitive.
Photo of Dan

Dan

  • 1,176 Points 1k badge 2x thumb
This just blew my mind a little. I did not know you could omit the If().
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,322 Points 20k badge 2x thumb
QuickBase's formula language is an almost pure functional language where every valid formula returns a consistent value. The only exception to purity are those formulas that use the functions Today() or Now().

The equals operator (ie "=") just compares two values of the same type and returns a Boolean value so there is no need for an If() function.
Photo of Roth

Roth

  • 30 Points
Contains([Accounting Solution],"QB Online") 

suggested by Kevin Martens also works.  Thanks for this discussion.  Very helpful!