Summing in a Repeating Table - InfoPath Dev
in

InfoPath Dev

Summing in a Repeating Table

Last post 03-30-2006 08:36 AM by bajanpoet. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 07-11-2005 07:07 AM

    Summing in a Repeating Table

    Hi I have a form that has a repeating table in it. The table is called extra expenses. It stores how much money a person uses on a trip. There is also a textbox that I have totaling the over all money used on that trip. The first row in the repeating table will add to the total in the textbox but since the extra rows you add do not exist until after the form is being ran how do I tell the textbox to sum them, when there is nothing to point at?
  • 07-11-2005 06:14 PM In reply to

    Re: Summing in a Repeating Table

    Hi UAppsSean and welcome to our forum!
    This is easy to do with the fX (Function) button:
    1. In the Designer double click on the field in the view or in the data source
    2. Where it says default value, click on the "fx" button to the right of the field
    3. Click on the "Insert Function"
    4. Select Sum from the list of functions
    5. Now double click on the underlined text: "double click to insert field"
    6. Select the node in your data source that corresponds to the element in the repeating table that you want to sum

    That should be it! Note that the fields will have to be decimal, not textbox.

    Hope this helps!

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 07-15-2005 07:08 AM In reply to

    Re: Summing in a Repeating Table

    Thanks a bunch it worked I was just trying to use + is fx but this working. Thanks
  • 11-29-2005 01:57 PM In reply to

    Re: Summing in a Repeating Table

    Hi, Patrick. I have pretty much the same scenario as uappssean in his previous post, but with an added dimension to it.

    Let's say instead of summing a single field in a repeating table, I want to multiply field1 by field2 in the same repeating table, and then summing the resulting product and displaying the aggregate value in an expression box outside the repeating table. Can this be done using the same advice you mentioned previously, and without having to use code?

    I tried creating an XPath formula to accomplish this (sample below) but can't seem to get the proper syntax. Your help is greatly appreciated.

    sum(dfs:dataFields/d:TXNTABLE/d:DISB_DETAILS/@DISB_QTY * dfs:dataFields/d:TXNTABLE/d:DISB_DETAILS/@DISB_AMT)
  • 11-29-2005 02:16 PM In reply to

    Re: Summing in a Repeating Table

    Yes, you can do this without using code. However, you'll have to do it in two steps: Multiply col1 by col2 and store in col3 and then sum all of the col3s.

    Say you have 3 columns in a repeating table. Col1 and Col2 will be the input columns and Col3 = Col1 * Col2. The function in Col3 can be obtained by doing "Insert field or group..." for Col1 and Col2 and then putting a "*" between them.

    Now, all of your Col3s are the multiplications of Col1 and Col2.

    Make a textbox (or expression box) outside of the repeating table. Change it to be the correct data type (integer, decimal, etc.) Now, go the function box of this new textbox and hit "Insert Function..." find "sum" and hit "OK". Double-click where it says "Double click to insert field" and choose Col3 in your DOM.

    Viola!

    If you don't want to display your Col3 you can just delete the column from the table that displays - it won't affect the formulas.

    ---------------
    Matt Faus
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 11-30-2005 07:24 AM In reply to

    Re: Summing in a Repeating Table

    Hi, Matt. It worked great! Thanks a lot. I was hoping to not have to create a column 3 since I didn't want it shown in the form, but your suggestion to create and hide it serves the same purpose.

    Thanks again.

    Andrew
  • 11-30-2005 11:30 PM In reply to

    Re: Summing in a Repeating Table

    Hey guys,
    Sorry for delay. Matt's right. You need to add a node. You can add it to your secondary DOM however and reference this in your view without polluting your main data source.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 03-30-2006 08:36 AM In reply to

    Re: Summing in a Repeating Table

    I've done this (Col3 = Col1 * Col2, Total = Sum(Col3)) but my Total field is not updating.

    What do I do?
Page 1 of 1 (8 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.