Sum Multiple Fields - InfoPath Dev
in

InfoPath Dev

Sum Multiple Fields

Last post 07-31-2012 09:02 AM by ebonymb. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 03-17-2010 04:15 PM

    Sum Multiple Fields

    Hi,

     I think this is a simple one. I have 5 seperate fields, each with a value in them. I have another field called "Total". How did I sum all the 5 seperate fields to put the total in the "Total" field.


    Thanks

  • 03-17-2010 04:20 PM In reply to

    Just use a formula for the default value for your "Total" field and use the Insert field or group button to select each of your fields. Then put a + sign between the fields....

    Hilary Stoupa

  • 01-18-2012 11:59 AM In reply to

    • Fierhauk
    • Not Ranked
      Male
    • Joined on 10-11-2010
    • Santa Rosa, CA
    • Posts 20

     Every time i need an answer on InfoPath or qRules it's a Hilary post that has it.

     A couple years before i needed it, but thanks!

  • 06-07-2012 05:41 AM In reply to

    Thanks - it seems like it should be more complicated that that for some reason.
  • 07-31-2012 07:27 AM In reply to

    I have a formula to to sum 5 fields which are all set to data type Decimal (double), Currency format, and 2 decimals.  The total field formula = sum(PRIN) + sum(INT) + sum(ANNUAL) + sum(LATE) + sum(OtherFees)

    For some reason, when PRIN = 2.90, INT - 1.03, and all other fields = 0.00, the total sums as 3.9299999999999997 instead of 3.93. 

    The issue has not occurred on other sum totals so far. Any idea why it isn't calculating 3.93?

  • 07-31-2012 08:19 AM In reply to

    Have you saved your XML and looked at it in a text editor? I have a feeling your other controls may be set to display only two decimal places and PRIN and INT are not the values you think they are - that the formatted and actual values are different.

    Hilary Stoupa

  • 07-31-2012 09:02 AM In reply to

    I figured it out.  http://www.infopathdev.com/forums/t/11349.aspx  The problem was with floating arithmetic.  I thought it was weird that the problem occurred randomly and out of 20 or so requests, this was the first time it had happened.  I was able to resolve it with the following formula.  (PRIN + INT + ANNUAL + LATE + OtherFees) * 100 / 100

Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.