4 Replies Latest reply on Jun 1, 2011 8:10 AM by philmodjunk

    Question using "IF" in Calculation Field

    MaiconPiovesan

      Title

      Question using "IF" in Calculation Field

      Post

      Hello,
      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:
      http://cl.ly/142e1g001e2Y0Z2P2m1b
      http://cl.ly/1l0Z1X2h2q1P2X1d200M

      Thanks a lot for the help!