Checkbox Formula - field does not contain text

  • 1
  • 1
  • Question
  • Updated 2 years ago
  • Answered

working with "Contains".
Example: If(Contains(ToText([Approvals Needed:]),"Quality Assurance") and Contains([Approvals Logged],"Quality Assurance"),true)

However, I cannot figure out how to change it to work from the condition that the field "does not contain" something.
Example using "excludes" as the opposite: If(Exludes(ToText([Approvals Needed:]),"Sales"),true)

I do not know how to write this where not having certain text included in the field is the condition. Any help?

Thank you~


Photo of Wes McAda

Wes McAda

  • 132 Points 100 badge 2x thumb
  • like I am running out of time

Posted 2 years ago

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

QuickBaseCoach App Dev./Training, Champion

  • 65,664 Points 50k badge 2x thumb
you can do this

If(not Contains(ToText([Approvals Needed:]),"Sales"),true)

The not just reverses the result form True to false or false to true.

But  for a Boolean result, you don't need the IF

For example, your original 

 If(Contains(ToText([Approvals Needed:]),"Quality Assurance") and Contains([Approvals Logged],"Quality Assurance"),true)

could also be written


Contains(ToText([Approvals Needed:]),"Quality Assurance")
 and
Contains([Approvals Logged],"Quality Assurance")

just easier to read 

That is basically a statement you are making and QuickBase decides if you are telling the truth and return true or else calls you a liar and returns false.

So on your second test

not Contains(ToText([Approvals Needed:]),"Sales")

will be true if the approvals do not need sales approval.



Photo of Wes McAda

Wes McAda

  • 132 Points 100 badge 2x thumb

Thank you for giving me what I needed. This is a formula that I ended up with, and it seems to be working:

If(not Contains(ToText([Approvals Needed:]),"Sales") or
(Contains(ToText([Approvals Needed:]),"Sales") and Contains([Approvals Logged],"Sales"))
,true)

Photo of Chris

Chris

  • 4,430 Points 4k badge 2x thumb

Since the function Contains is Boolean, check for a true condition anyway, then do the opposite of what you'd do if the [Approvals Needed:] contained "Sales".

if(contains(totext([Approvals Needed:]), "Sales", false,true)

Just turn around the true,false and make it instead false, true.

Photo of Wes McAda

Wes McAda

  • 132 Points 100 badge 2x thumb
Thanks for the idea.