Sum on Repeating Table - InfoPath Dev
in

InfoPath Dev

Sum on Repeating Table

Last post 09-26-2012 07:55 AM by infopathdude. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 08-22-2012 07:19 AM

    Sum on Repeating Table

    Guys, I have been using infopath for a while and I always find challenging implementing basic functions...I rem I had to perform a division on couple of fields and had some tough time...I think it was  just me once i figured it out...:(

    Well today I am struck with a new issue which i thought would be no issue..Trying to write an expense report form ...Have a repeating table to enter expense details

    Now after all the expenses are entered i need to group them by expense categories and show the sub total for each category in a separate section

    For Eg-Expense Detail Repeating Table

    Rental-$10

    Food-15$

    Hotel-$50

    Food-$20

    Misc-$30

    Hotel-$50

    Rental-$10

     

    I want the summary section to go thru the repeating table, pick these expense categories and summarize them as

    Rental-$20

    Food-$35

    Hotel-$100

    Misc-$30

    How do I accomplish this, trying to do this in browser enabled forms

    I have read about preceeding-sibling,following-sibling,eval but don't seem to figure out where to start...

    Preceeding sibling will only tell me the last expense category, seems like i need to be able to iterate the repeating table to get the groupings...

    Also not sure how does the preceeding functions impact when you try to insert an entry in the middle of the table ..

    Please help


  • 08-22-2012 08:47 AM In reply to

    There's a sample form here that I think will help you.

    Hilary Stoupa

  • 08-22-2012 10:25 AM In reply to

     Hilary, thanks a ton...that was so simple...forgot abt current function

  • 09-25-2012 07:06 AM In reply to

     Hilary,

    You helped me on this before....I have to extend this a tad bit and I thought I should be able to do figure this out by myself :(

    I need to add an additional column to the repeating table and the sum depends on two fields now

    So 

    For Eg-Expense Detail Repeating Table

    Rental | A |-$10

    Food | A |-15$

    Hotel | B |-$50

    Food | B|-$20

    Misc | A |-$30

    Hotel | A |-$50

    Rental | A |-$10

     

    I want the summary section to go thru the repeating table, pick these expense categories and summarize them as

    Rental | A |-$20

    Food | A |-$15

    Food | B |-$20

    Hotel | A |-$50

    Hotel | B |-$50 

    Misc | A | $30

     

    I tried to change the Sum filter to say sum(amount[exptype=exptype and code=code]) but it doesnt seem to add values of same code and type like shown above...it just shows the amount from the first exptype

    Any thoughts on what am I doing wrong?

     

     

     

  • 09-25-2012 09:01 AM In reply to

    What's the full XPath of your formula? You can check the Edit XPath box in the formula editor...

    Hilary Stoupa

  • 09-25-2012 11:56 AM In reply to

    sum(/my:myFields/my:group1/my:group2/my:field2[../my:field1 = current()/../my:field1 and ../my:Code = current()/../my:Code])

    I have extended the infopath template what you had sent me, but cannot find a place to send this to you..Please advise if there is a way for me to send this....

    Thanks for your prompt response


  • 09-25-2012 12:33 PM In reply to

    You can attach it to a post under the Options tab - I'll try to take a look later today or tomorrow morning.

    Hilary Stoupa

  • 09-25-2012 01:13 PM In reply to

     Posted as advised..Thank you for ur help

     

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

    The conditional formatting on the repeating summary table was the issue - here's a revised version.

    Hilary Stoupa

  • 09-26-2012 07:55 AM In reply to

     As always, thank you.....

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