10 Replies Latest reply on May 11, 2012 5:57 AM by philmodjunk

    Calculation fields won't automatically show result

    millie

      Title

      Calculation fields won't automatically show result

      Post

      Hi.  Can anyone help?  I have set up a simple set of fields which take various costings, apply a discount and calculate them all up into one total order amount.

      I have maybe 6 fields of various figures, a discount field and a vat field along with a couple of subtotal fields and a grand total.  All the calculations work ok except they only show if you click on each field.  Until then, they remain empty.

      I have taken a look at other posts and have set the actual subtotals and grand total field to be calculations and not numbers fields with calculations within them.

      Is there a script I should use to make this update the record?  It is possible that various costings will change so the calculations need to update automatically and show the revised figure when updated.

      Thanks!!

        • 1. Re: Calculation fields won't automatically show result
          philmodjunk

          What return type did you select for them in the specify calculation dialog?

          • 2. Re: Calculation fields won't automatically show result
            millie

            I have set them up as global fields returning the calculation as a number.

            I did originally have them as unstored but this didn't seem to make any difference.

            • 3. Re: Calculation fields won't automatically show result
              philmodjunk

              Remove the global storage setting. Global calculations evaluate in unusual ways that often do not work the way a user expects. If you need the value to be globally accessible, there are alternative ways to do that.

              • 4. Re: Calculation fields won't automatically show result
                millie

                Hi!  Thanks for your answer, PhilModJunk.

                I have re-created the calculation as totalling up the Number fields to a Calculation field.  The calculation formula I entered was (FIELDNAME1 + FIELDNAME2).  I didn't set to a global field in this case but left it at this.

                This still only calculates or updates an amended entry when you click on the 'Subtotal' (ie calculation) field.  Should I create a script to Commit record?  I did try this after reading another post but it didn't seem to make any difference.

                Thanks!

                • 5. Re: Calculation fields won't automatically show result
                  Abhaya

                  Hi

                   

                  Pls check followings...

                  >Should be unstored and must be number as return type

                  >Do as "evaluate alwasys" for that calculation.

                   Hope you 'll get your result.

                   

                  Thanks

                  • 6. Re: Calculation fields won't automatically show result
                    millie

                    Hi Atauf.  They are unstored and returning as numbers.  I have tried using the calculation as Evaluate (field1 + field2) and this has worked.

                    However, one of the calculation fields needs to be modifiable and I can only make a calculation field modifiable if this a Number and not Calculation field.  By changing the field type, the calculation no longer works - is there any other way of tackling this?

                    Basically, my pattern needs to be:

                    item1 * Item2 = Item3.  BUT Item3 needs to be modifiable if we have negotiated a lower price than the calculation, which occurs 50% of the time.

                    Item3 + Item4 + Item5 = Subtotal

                    Subtotal + VAT = Grandtotal

                    When Item3 is a calculation field, all the other fields update.  But I cannot modify it to allow for a variation in cost.

                    Thanks for any advice you can give!!

                    • 7. Re: Calculation fields won't automatically show result
                      Abhaya

                      Hi

                      If you want the item3 field to be modify(some condition) then make its type as Number.

                      and its autoenter calculation just write this

                      if(item3<50% value ;""; item1*item2)

                      [means if condition fails then you can enter manually otherwise it fetches its value automatically]

                      make it evaluate always..

                      Hope will get the result......

                       

                      Thanks

                      • 8. Re: Calculation fields won't automatically show result
                        millie

                        Hi Atauf.

                        Thank you for your helpful response.  I am trying to get the calculation to work but I am receiving an error message as the calculation seems to think that % value is a field. 

                        Can I check that my calculation entry is correct?

                        Thanks!

                        • 9. Re: Calculation fields won't automatically show result
                          Abhaya

                          keep all character in "" means all the value except the numbervalue

                          • 10. Re: Calculation fields won't automatically show result
                            philmodjunk

                            if(item3<50% value ;""; item1*item2)

                            Should be writtn as:

                            if(item3< 0.5 ;""; item1*item2)

                            If this is an auto-enter calculation instead of a field of type calculation, you have two additional issues:

                            Did you clear the "do not replace existing value..." check box?

                            Creating or modifying an auto-enter calculation will not automatically update values in the field for existing records. The value in the field will evaluated for each new record created and for each time a field referenced in the calculation is modified.

                            There are two ways to update your existing fields:

                            1) Show all records and use the same expression with replace field contents to update them

                            2) Temporarily change the auto-entered calculation into a field of type calculation. Click Ok to leave manage | database. Then return and change it back into an auto-entered calculation. When you make each of these changes, you'll find that you do not need to re-enter expressions. FileMaker keeps them for you.