If Then Else - Calculate on the "Then"

Hi I need to be able to calculate within the “THEN” part of the statement


But all I can enter for the THEN section is a column title OR a math statement - not both

Is there any way I can use a column plus a math statement ?

Add a math column in your Glide data, calculate the (Working Fee/2)*(.05) for all cases. Let’s say it’s named “Fee”.

Then add an If > Then > Else stating:

  • If At full bareme? is True then Fee (assign the column).
  • Else 0.
1 Like

Thank you for the work arround - Strange that the THEN part of the statement can’t include a calculation !
Mike

2 Likes

Thanks - that worked just fine -
and thanks to the Glide team - App No.2 now finished - loving it !

1 Like

@Mike_Greene great suggestion! It makes total sense that glide should work the way you originally tried.

2 Likes

I know what you feel @Mike_Greene

I have been waiting something like this too:
image

In this way, we could write values to any field directly and have some kind of logic within Data Editor and make it more powerful. My example will be the easiest way to create a reset button and clear other fields/values directly.

Saludos

2 Likes

Reviving a very old thread here as I came across the same problem.

Basically I want to create the following…
If Field A is 1
then number of Days(Field B) * 100
If Field A is 2
then number of Days(Field C) * 100
etc.

Was this implemented in Glide? I can’t seem to get it to work.

Cheers
Rob

No. You can’t do calculations within an IF column. Your options are:

  • Use a Javascript column to handle the IF condition and the math
  • Create two math columns and then use an IF to pick which result you want.

Here’s a math alternative:

100 * (B * (2 - A) + C * (A - 1))

When A = 1, the formula simplifies to:

100 * (B * (2 - 1) + C * (1 - 1)) = 100 * (B * 1 + C * 0) = 100 * B

When A = 2, the formula simplifies to:

100 * (B * (2 - 2) + C * (2 - 1)) = 100 * (B * 0 + C * 1) = 100 * C

I know you said number of days, but the formula can give you a head start.

1 Like