Conditional sum within a repeating table - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Conditional sum within a repeating table

Last post 09-10-2009 05:43 AM by Tracie. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 09-03-2009 08:32 AM

    Conditional sum within a repeating table

    Hello,

     I am working in InfoPath 2003 and would like to sum data taken from a repeating table.  However, this sum needs to be based on the value of a second field. 

    For example - the table has a column for Amount and a column for Credit/Debit.  If the Amount is < 0, the value in the Credit/Debit column is set at C.  If the Amount is >/= 0, the value in the Credit/Debit column is set at D. 

    My goal is to have a field labeled Credit equal the sum of Amount when Credit/Debit = C and a field labeled Debit equal the sum of Amount when Credit/Debit = D.

    I set the following rule from the Credit/Debit field:  If Credit/Debit = C then set the field Credit to equal the sum of Amount.

    However, the Credit field only shows that last value of Amount when Credit/Debit = C. 

    How do I show the sum of Amount for each C and D?

    Thank you,
    Tracie

  • 09-03-2009 01:30 PM In reply to

    Re: Conditional sum within a repeating table

    You'll want to set the Credit field to Credit + Amount. I've attached a sample template to this post -- all the rules are on Amount (field2, sorry, I was lazy and didn't rename). You can right click the link in the post header and save the template locally, then open in design mode and preview to test.

    Hilary Stoupa

  • 09-03-2009 01:44 PM In reply to

    Re: Conditional sum within a repeating table

    That worked, thank you so much!!
  • 09-09-2009 07:21 AM In reply to

    Re: Conditional sum within a repeating table

    I have another question!  Is there anyway to have the summed totals recaluculate when the values in the table change?  Currently, if something changes from a credit amount to a debit amount, the credit is not removed from the total. 

     Thank you!

  • 09-09-2009 08:28 AM In reply to

    Re: Conditional sum within a repeating table

    the field in which you are writing the formula to calculate the sum, just check the box that says update the value when the result of the formula is recalculated

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 09-09-2009 10:35 AM In reply to

    Re: Conditional sum within a repeating table

    Thank you for your response Qazi, but the calculation is pulling from a rule.  Is there a way to configure the rule to update the field's value?

  • 09-09-2009 02:32 PM In reply to

    Re: Conditional sum within a repeating table

    It is important to note that rules fire when the field they are on changes. So if the rule is on the Amount field, and the amount doesn't change, any rule on it won't fire. I like Qazi's suggestion of setting a default value instead on the Credit and Debit fields to sum the correct nodes. See the attached template for the general idea...

    Hilary Stoupa

  • 09-10-2009 05:43 AM In reply to

    Re: Conditional sum within a repeating table

    Thanks, that worked!

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