Is there an easy way to deal with Multiple conditions?

I’m having a a bunch of conditions that needs to be met for a checkbox to be checked.

The only way I’ve come up with so far is making a ton of IF/THEN/ELSE columns that gives every conditions a value and then calculate my way out of it.

But i’m ending up with so many columns, is there an easier way of doing multiple conditions?

I guess the first thing to understand about the Glide if-then-else column is that it is exactly what it says it is: if-then-else

It’s not if-and-then-else, it’s not if-or-then-else, and it’s not if-and-or-then-else.

If you’ve ever done any programming, you can think of it being a bit like a switch statement. That is, you have a series of conditions, and as soon of one of those conditions matches it will execute the associated block and return. And if all else fails, you have an optional default condition to fall through to.

It might seem very limiting at first, but with a little bit of creative thinking you can handle some quite complex conditional logic with a single if-then-else column.

In general, the trick is to work your way backwards. That is, instead of twisting your brain trying to come up something that returns true straight off the bat, just start by eliminating your negative conditions one by one. And then anything that makes it past all that can be considered “true”.

A simple example is creating a validation check for required values in a custom form. Imagine that you have a form where a user enters name, email, title, avatar and you don’t want to allow them to submit the form unless they’ve provided all values. You’d be tempted to try and do something like “if name is not empty, and email is not empty, and title is not empty, and avatar is not empty, then true”

But of course you can’t do that. But by working backwards and using a process of elimination, it becomes easy:

  • If name is empty, then null
  • if email is empty, then null
  • If title is empty, then null
  • If avatar is empty, then null
  • Else true

It can take a bit to get used to it, but once you have your head around it, it’s not too bad.

If you have specific examples that you’re struggling with, feel free to post them and we’ll do our best to help you out.

5 Likes

Thank you Darren

It might be my brain that is a little worn our towards the end of the day, but I don’t seem to be able to figure out something simple like

If [TEXT] is ‘Hello’ AND [COUNT] is checked then TRUE

  • If Text is not Hello, then null (leave empty)
  • If Count is not checked, then null
  • Else true
1 Like

Ohh god… my brain is fried - I need fresh air.
Thank you for even answering back on this simple question

2 Likes

Glide ITE is best used with failure conditions like Darren showed.

Once you get past all the ‘easy’ failed conditions you create a Column (or two) within the row that resolve to a FAIL to handle any other conditions.

Paraphrasing Sherlock Holmes:
“Once all FAILs are processed, whatever remains (no matter how improbable), must be TRUE.”

5 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.