Forum Discussion

WesMcAda4's avatar
WesMcAda4
Qrew Champion
8 years ago

Checkbox Formula - field does not contain text

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~


  • 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.



    • WesMcAda4's avatar
      WesMcAda4
      Qrew Champion

      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)

  • ChrisChris's avatar
    ChrisChris
    Qrew Assistant Captain

    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.