1 Reply Latest reply on Oct 15, 2014 2:53 PM by philmodjunk

    Help putting together a calculation

    Shane-O

      Title

      Help putting together a calculation

      Post

      Hi all - Can someone please help me translate the below into a calculation?

      If Field A= "1" then multiply Field C by 75. The answer must be reflected in Field D.

      If Field A= "2" then multiply Field C by 65. The answer must be reflected in Field D.

      If Field A= "3" then multiply Field C by 55. The answer must be reflected in Field D.

      If Field A= "4" then multiply Field C by 45. The answer must be reflected in Field D.

        • 1. Re: Help putting together a calculation
          philmodjunk

          Define Field D as a calculation field:

          Option 1:

          Case ( Field A = 1 ; Field C * 75 ;
                     Field A = 2 ; Field C * 65 ;
                     Field A = 3 ; Field C * 55 ;
                     Field A = 4 ; Field C * 45 )

          Option 2:

          ( (4 - Field A) * 10 + 45 ) * Field C

          Option 3:

          Set up a related table of Field A values (1, 2, 3...) with a second field to hold the 75, 65, etc values. Then define a relationship linking the Field A values in this new table to Field A in your original table.

          A calculation or auto-enter calculation can then be set up as:

          Field C * RelatedTable::Factor

          where "Factor" is the field in the related table that stores values of 75, 65, etc.

          This last option allows a non filemaker developer to update what values are used by editing data in a table instead of having to redefine the calculation to use different values.