Guide for using If Then Else

Hi all. I’m looking for some guidance on how to use the if then else conditions. I have two at the moment I know I want to set conditions on but not sure how to go about it so if anyone can point me to a guide or something, that would be appreciated.

My first one I want to do is regarding fields in a component (see below). I don’t want to show the Age field if the Status is Deceased.

My second one more trickier (I think) as it involves date calculations.- might be out of my league at the moment, but figured no harm in asking. So same component but this time in the collection. If the date of Vax - First is 30 days before today and there is no Vax - Second, then email the current foster carer (a reminder that the next vax is due).

I hope to have a few of these checks but these are just an example… if I can get these working, then I hope I can work out the others. But I have no idea how to even approach these yet and I can’t find anything with my googling (but I’m still looking). Thanks in advance.

  • If Status is Deceased, then null (leave empty)
  • Else Age

then use the if-then-else column to represent the Age in the fields component.

  • Start by creating a math column using the formula Now-30. This will give you the date 30 days ago.
  • Then the if-then-else column:
    – If Vax Second is not empty, then null (leave empty)
    – If Vax First Date is before math column, then true

Any of the rows where the if-then-else is checked will represent those that have a Vax due.

1 Like

What is the trigger for this? A button or a schedule?

It would need to happen without user interaction so I assume a schedule, say run once every 24 hours? Is that what you mean?

Thanks. I need to get my head around how to add in the if then side of things. I’m a bit brain dead at the moment due to illness so I’ll revisit this once I’m feeling well and maybe it will all make sense and be obvious. Right now I can only see the option for setting visibility to the whole component, not to just that field.

Running things on schedules is only really possible if you have a paid plan, which I don’t think you do?

You’re taking about two different things here…
An if-then-else column lives in the Data Editor. It’s useful for returning different values based on conditions. “If X, then Y, else Z”
Visibility conditions live in the Layout Editor. They are used for showing or hiding components based on conditions.
An if-then-else column can be used in a visibility condition, but fundamentally they are two different things.

Ahh yeah I’m still in the free version but hoping we can maybe get a paid version via sponsorship. Still working on that. Good to know that that function is not on the free versions so I can stop looking :smiley_cat:

And I will have to review it all again to fully comprehend the if then else and the visibility setting. Thanks for clarifying.

Ok, yep, its the layout editor and visibility conditions that I’m talking about. Apologies for that. I was getting myself confused because I was saying to myself “If the status is deceased, then don’t show the age field” so I was taking it to be an If/Then/Else. :joy:

So how would I do that in the below instance. The visibility condition refers to the whole component. Or is it a matter of breaking the component up into individual fields rather than a collection of fields and THEN applying the visibility condition to the Age field?

Okay, you can use my original suggestion…

The Fields component will automatically omit any value that is empty.

OMG! I get you now! I do that right back on the Data screen in a new column - create a new if then else column saying if status is deceased then null else age - BUT then in the layout screen when wanting to refer to the calculated age, I use the newly created column! I GET YOU! Happy Dance! \o/ Thank you for persisting with me… thank you, thank you, thank you!

2 Likes

Yep, that’s it. You’ll be a pro before you know it :wink:

1 Like