And/Or for If → Than → Else Column

Please add option in conditions in ‘If → Then → Else’ column to add an ‘and/or’ like in the visibility conditions.

Thanks :pray:

Can you give a practical example of something you’re trying to do, but can’t?

Chances are it is possible, with a little bit of creative thinking.

Please keeps the votes going on this one.

Hey @Darren_Murphy, I’m working on a car rental app (you helped me a last week with it here).

When a user searches for available vehicles within a timeframe, I want to display the price it will cost them for each vehicle (prices are different for each vehicle class/type). When they select the vehicle and reserve, I want to create a record in the bookings table and set the price for that booking with ‘set column values’ from the price it was displaying for them while searching.

Each vehicle has an hourly rate and a daily rate. For example, a car can have an hourly rate of $20/hr and a daily rate of $90/day. I want to set one total booking price column with the following conditions:

If total booking days is equal to or greater than 1, then apply daily rate.

If total booking days is less than 1, AND total price (hourly rate) is greater then daily rate, then apply daily rate. Else, apply holy rate.

Essentially, if someone is booking for example for 5 hours, I don’t want to apply hourly rate (which will total $100, and exceeds daily rate), instead I want to apply the daily rate.

The only way I see it being done now is by setting visibility conditions on the component displaying the price on each vehicle while user is searching, and setting the same conditions again when setting column values in the action flow when finalizing booking.

It would be much easier if I hade one If Than Else column that I would be able to set above conditions, and use it for displaying the price while searching, and setting column values in final booking.

1 Like

Okay, try this:

  • Start by creating two math columns. One to calculate the total cost based on the daily rate, and another to calculate the total based on the hourly rate.
  • And then create your if-then-else column as follows:
    – If number of days is equal to or greater than 1, then calculated daily total
    – If calculated hourly total is greater than calculated daily total, then calculated daily total
    – Else calculated hourly total

I think that should do it?

I’ll give a precise example to demonstrate the problem and why the solution you provided won’t work.

Car costs $20/hr and $70/day. User wants to reserve it for 5 hours. As it stands, the math column calculating the hourly rate ($20 * 5) will total $100, and the math column calculating the daily rate (booking_days * $70) will total $14.58 (since total booking days for 5 hours = 0.21).

In this case, I can’t apply the calculated daily rate since it’s not accurate ($14.58), rather, I need to apply the daily rate X1 ($70).

That’s why I need the ‘AND’ in my condition to check if hourly rate is greater than daily rate, AND booking is less than 1 day, apply daily rate X1.

Without the AND, it will always apply the daily rate X1 to any booking that’s 1+ days since the hourly rate will surely be greater then the daily rate (the daily rate is a discount).

ah, that makes it clearer.
Okay, still quite doable. Just need to adjust the logic slightly:

– If booking days is equal to or greater than 1, then calculated daily total
– If calculated total based on hourly rate is greater than daily rate, then daily rate
– Else calculated total based on hourly rate

The difference is in the second case. Instead of comparing the calculated hourly total to the calculated daily total, we compare it to the daily rate.

One thing I should point out about the if-then-else column is that it exits as soon as a condition passes, and ignores any remaining conditions. So if we apply the above to your example:

  • Case 1: Booking period is less than one day: fails - move to next case
  • Case 2: Calculated total based on hourly rate ($100) is greater than daily rate ($70): passes - return daily rate
  • Case 3: Ignored.

@Airon_Studio - and just to demonstrate that it works, please watch this:

1 Like

Does the holy rate apply when you book the popemobile through the app? :grin:


Thank you very much for the reply and the video! I tried it and it works. @Darren_Murphy you are fantastic!

I wasn’t sure if it would work this way since it isn’t clear how the conditions work if they aren’t met.

Now Iv’e tried it and it works, thank you for that.

P.s. what’s the formula to calculate how many hours between two times, I was only able to figure out how to calculate the days. HOUR(date/time - date/time) only gives me the hour number but not total calculated hours.


1 Like

Here is what I used:

Round(End - Start,2)*24

Yeah, it takes a little to get used to how the if-then-else column works (and how it can be used) - it’s not particularly intuitive.

1 Like

Thank you :pray:

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