Sum Calculations from a Repeating Table which is populated from SQL Data - InfoPath Dev
in

InfoPath Dev

Sum Calculations from a Repeating Table which is populated from SQL Data

Last post 09-18-2014 11:27 AM by RaYvA. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 05-16-2014 08:33 AM

    • GCTEK
    • Not Ranked
    • Joined on 05-16-2014
    • Posts 4

    Sum Calculations from a Repeating Table which is populated from SQL Data

    Hello,

     Im trying to get a calculated value to add all the totals from one line as a "final" figure within my InfoPath 2010 form.  The data is in a repeating table and i just cant seem to get the calculations correct.

    My table is faily basic, and is filtered to only show rows that have specific data. this part is working with no issues. within this table we have a Quantity column and a Unit Price column and a new column was added for "Line Price" which is a calculated value which simply takes the Line Price and multiplys this by Quantity.  this is working fine and the values are all correct.  What i want is that at the bottom of this table to have a TOTAL which is the Line Price for each line totalled up. I have added a Footer line to the table and created a new field for my TOTAL but i cant use the "sum" function to add up the calculated values. The Data Connection is Receiving data from SQL.

    Any advice greatly appriciated

  • 05-18-2014 07:25 PM In reply to

    Re: Sum Calculations from a Repeating Table which is populated from SQL Data

    Hi GCTEK,

    Since you are using calculated values, you will be unable to use the sum function properly. There are two options you can do, A) add a condition to your sum formula (you'll also need to include the quantity column here), or B) use an unused column which will hold the total value per row, which you can easily use for the sum function. Is this approach not possible for you? Please let me know.

    Don Stephen Lambatin / Support Engineer
    Qdabra Software
  • 05-19-2014 02:09 AM In reply to

    • GCTEK
    • Not Ranked
    • Joined on 05-16-2014
    • Posts 4

    Re: Sum Calculations from a Repeating Table which is populated from SQL Data

    Hey,

    Thanks for the reply.  When you say "Add a condition to your sum formula" what do you mean?  I will look at the unused column but im not the DB owner and will have to check with the developer if he is happy for that to happen to store the values.

    Thanks again

  • 05-20-2014 09:19 PM In reply to

    Re: Sum Calculations from a Repeating Table which is populated from SQL Data

    Hi GCTEK,

    A conditional sum formula would look like the formula below: 

    sum(field1[field2 = "Test"]) 

    Where field2 will have a condition that it is equal to Test. You can achieve this by adding a Filter Data as shown below:

     

    However this approach is tedious as opposed to using an unused column.

    Regards, 

    Don Stephen Lambatin / Support Engineer
    Qdabra Software
  • 06-10-2014 07:57 AM In reply to

    • GCTEK
    • Not Ranked
    • Joined on 05-16-2014
    • Posts 4

    Re: Sum Calculations from a Repeating Table which is populated from SQL Data

     Thanks for the replay and apoligise for the slow reply.  not had much chance to work on this of late.  Im sure I will get to the bottom of it one way or another

     

    Regards 

  • 09-18-2014 11:27 AM In reply to

    • RaYvA
    • Top 100 Contributor
    • Joined on 05-09-2013
    • Melbourne, Australia
    • Posts 86

    Re: Sum Calculations from a Repeating Table which is populated from SQL Data

    GCTEK:

     Thanks for the replay and apoligise for the slow reply.  not had much chance to work on this of late.  Im sure I will get to the bottom of it one way or another

    Regards 

     

    I'm not sure what the problem is here, it shouldn't matter where your data is coming from (your secondary data source) because you should be able to sum anything in you primary data source!!!

    I've added an example for you to look at.... Let me know if it helps!?!?!

     

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