Total the Values in a Repeating Table - InfoPath Dev
in

InfoPath Dev

Now you can find InfoPathDev on YouTube and Twitter!

Total the Values in a Repeating Table

Last post 09-04-2009 02:13 PM by Greg Collins. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 07-01-2009 08:03 PM

    Total the Values in a Repeating Table

    Hi,

    I have a repeating table on my form that has 2 columns. One column has a drop down list of account names. The second requires a figure. The user is required to select an account name in the first column and then enter a figure in the second column

    So for example the repeating table may look like this:

    Account A 20
    Account B 10
    Account A 20
    Account C 30
    Account A 15

     What I want to do is to display the total of each account at the bottom of the form. So will look similar to this:

    Account A 55
    Account B 10
    Account C 30

    I tried this post here http://www.infopathdev.com/forums/p/858/39921.aspx but unfortunately I couldn't get it to work. I was hoping someone could give me detailed step by step instructions on how I can achieve this or point me to a blog that may be able to help?

    Many thanks.

    Filed under:
  • 07-01-2009 10:22 PM In reply to

    Re: Total the Values in a Repeating Table

    Hi Ianijade,

    This is likely an xpath issue. Xpath is kind of tricky. Can you please attach your form and specify which table you are trying to sub-sum and where you want the total to show? I will ask one of our Xpath experts to take a look.

    Best!

  • 07-01-2009 10:29 PM In reply to

    Re: Total the Values in a Repeating Table

    Hi Patrick,

     Thank you very much. My form is attached. At the moment it is just one repeating table. I would like to sum the value column for each account.

    And would like this to show at the bottom of the form.

    I also should let you know, that the 'account' drop down will eventually be a data connection to a SharePoint list. This list is dynamic so will change on a regular basis. It also has over 50 account options.

    Thank you.

     

  • 07-01-2009 10:30 PM In reply to

    • Anuma
    • Top 25 Contributor
      Female
    • Joined on 07-20-2005
    • India
    • Posts 525

    Re: Total the Values in a Repeating Table

    Hi,

    Add below formula to the Total Fields

    Acccount A Total Filed:  sum(field2[field1 = "Account A"])

    Acccount B Total Filed:  sum(field2[field1 = "Account B"])

    Acccount C Total Filed:  sum(field2[field1 = "Account C"])

    Field1 --> Account Names field

    Field2 --> Value field

    For more idea verify attached xsn.

  • 07-01-2009 10:40 PM In reply to

    Re: Total the Values in a Repeating Table

    HI Anuma,

     I understand that I could just hard code into the form

     "Account A Total"

    "Account B Total"

    But then each time a new account is added to the sharepoint list, I would have to go in and add another account total to the bottom of the form. Plus there is over 50 accounts and not all of them will be used, therefore this will clutter up the form.

    I really need the Account Totals to be dynamic, in this I mean, I only want 'account A total' to appear if in fact, 'Account A' was selected in the repeating table at some point.

  • 07-01-2009 10:56 PM In reply to

    Re: Total the Values in a Repeating Table

    Hi Ianijade,

    I've asked Greg to also respond. Please check back here in a day and if you don't see a reply, send me e-mail.

  • 07-02-2009 09:13 AM In reply to

    Re: Total the Values in a Repeating Table

    What you are trying to do is not impossible... it just takes a good understanding of XPath and the current() function. They can be tough to wrap your mind around, but once you get there, they aren't too difficult to work with.

    The basic path is to create a second "summary" copy of your table. Then you need to add filtering (or conditional formatting if you are working with a secondary data source) and an expression box for the sum.

    I've attached a simple XSN which demonstrates how to do this for either the main DOM (filters) or a secondary DOM (conditional formatting). You could use conditional formatting for either, but filters are more efficient.

  • 07-02-2009 01:51 PM In reply to

    Re: Total the Values in a Repeating Table

     

    Thanks Greg!!

     You have totally made my day!! And it's only 6.30 in the morning!!

     

  • 07-02-2009 03:44 PM In reply to

    Re: Total the Values in a Repeating Table

    Hi Greg,

     Sorry to bother you again. I can't seem to get this to work in a browser enabled form. It won't let me have the expression boxes in the repeating table or even a repeating section.

    Is there a way to do this with a browser enabled form?

    Thanks.

  • 08-14-2009 07:23 PM In reply to

    • Chara
    • Not Ranked
      Female
    • Joined on 08-15-2009
    • Posts 1

    Re: Total the Values in a Repeating Table

     Thanks for your post. It works! :) I'm also a newbie.

  • 09-04-2009 02:13 PM In reply to

    Re: Total the Values in a Repeating Table

    Browser forms are very picky about what they support and don't support. Unfortunately there are some things you just won't be able to do in a browser form... however some things just take some creative thought and a little experiementation.


    Good luck!

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