Question using "IF" in Calculation Field
I have some questions using "IF" in Calculation Field.
I'm a new FM user, and have some basic questions.
I need to calculate the following:
Let's say I sell apples, for example, in my store.
Sometimes I sell this item by piece, and sometimes I sell them by weight.
In my FM database, I have the following fields:
Number field: weight
Number field: quantity of pieces
Choice field: called "unit" with options "kilo" or "piece".
Number field: price
Calculation field: total to pay
If I sell the apples by weight, I inform to the Choice field "kilo", and the "total to pay" calculation field will calculate for me "weight" * "price".
If I sell the apples by piece, I inform to the Choice field "piece", and the "total to pay" calculation field will calculate for me "quantity of pieces" * "price".
How do I do this in FM? In Excel formula, this is what I use to do this:
=IF(price="";"";IF(unit="kg";(weight * price);IF(unit="pc";(quantity of pieces * price);0)))
It's possible to see the Form here (options by weight and by piece calculation) - these forms were for Bento, but now I'm updating to FM:
Thanks a lot for the help!