repeating table calculations (2ndary data source) - InfoPath Dev
in

InfoPath Dev

repeating table calculations (2ndary data source)

Last post 04-17-2006 11:05 PM by Abhishek. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 04-17-2006 06:39 AM

    repeating table calculations (2ndary data source)

    My form contains a repeating table that is populated from a secondary data source. The table contains two columns a "category" column and an "amount" column.

    There are three possible values that could be in the category column of each row, and I have three "total" fields in another part of the form.

    The idea is that one total will have the sums of all amounts that have a category of "a" , the second the sum of all amounts with category "b" the third with all amounts of catergory "c".

    I tried implementing this with a Rule on the amount field that would add it's own value to "totalfielda" if its category = a. This doesn't seem to work. Since the user doesn't input the values in the reapeating table, the Rule never gets invoked.

    Is there a way to do this without coding? And if not, how can I access each amount and category field in the reapeating table to perform the calculation for another field?
  • 04-17-2006 07:14 AM In reply to

    Re: repeating table calculations (2ndary data source)

    Hi Mairen,
    U can accomplish this without using code.

    Assume that u have 3 total fields namely TotalA,TotalB,TotalC.
    Also assume that ur repeating section fields are "Category" and "Amount".

    1)Double click on the TotalA text box.
    In the dialog that opens,there is a default value textbox.Beside that there is button(fx).
    Click that.

    2)In the "Insert Formula" dialog that opens,click the "Insert Function" button and select "Sum"
    Now select the Amount field such that ur formula looks as follows.
    sum(Amount).

    3)Also while selecting the Amount field, go to the filter and specify "Category = a".Now ur formula will look as sum(Amount[Category= "a"])

    4)Repeat the same for the TotalB,TotalC fields.

    Regards,
    Abhishek
  • 04-17-2006 07:59 AM In reply to

    Re: repeating table calculations (2ndary data source)

    This seems to work just fine. Thank you for your help.
  • 04-17-2006 08:41 AM In reply to

    Re: repeating table calculations (2ndary data source)

    Now I am trying this with a more complicated datasource. In this one there are nested repeating sections. For example there is a repeating section with start and end dates. This repeating section contains a repeating table.

    The repeating table contains the information I described above, a category and an amount. Now, if I want to total the amounts with a certain category, how would I go about doing this?
  • 04-17-2006 11:05 PM In reply to

    Re: repeating table calculations (2ndary data source)

    Hi Marien,

    So u have a repeating Section say "RS" and a repeating Table say "RT".

    Ur repeating Table RT contains the fields Category and Amount.

    Ur repeating section RS should contain the 3 fields say TotalA, TotalB, TotalC.For these 3 fields,set the default value formula as I specified above.
    Eg:For TotalA the formula is sum(Amount[Category= "a"])

    Keep another 3 fields outside the repeating section say GrandTotalA,GrandTotalB,GrandTotalC.

    Now GrandTotalA should have its default value set to.. sum(totalA).Similarly for GrandTotalB and GrandTotalC.

    So GrandTotalA will have the sum of all the amount whose category is A.

    regards,
    Abhishek

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