Nested repeating tables and sum - InfoPath Dev
in

InfoPath Dev

Nested repeating tables and sum

Last post 02-25-2013 03:40 PM by DTshin. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 07-17-2012 09:42 AM

    Nested repeating tables and sum

    Hello,

    I have a repeating table on an entry form that has fields: Job Role, Rate, Hours and it has a nested repeating table with additional fields: dropdown for each Milestone M1, M2, etc (MilestoneNum1) and Milestone amount (MilestoneAmount = rate x hours) for this job role.

    So far so good.

    I have a second repeating table that is used for automatic Milestone summary calculation which has another dropdown field (MilestoneNum2) and Milestone total field (MilestoneCost) which should total the above repeating table values for the job roles for each milestone for the selected milestone in drop down.

    The formula used in MilestoneCost is:

    sum(MilestoneAmount[MilestoneNum1 = MilestoneNum2])

    This works fine when there is only one summary milestone item in the 2nd repeater table but when another item is added to say sum up all M1 and M2 values it doesn't work right. It basically does a joined conditional where if it finds MilestoneNum1 in any MilestoneNum2 value in the entire set in the RepeaterTable2 it returns a true condition. What I'm looking for is just a match for that specific MilestoneNum2.

    Here is the field layout:

    RepeaterTable1

    - JobRole

    - Rate

    - Hours

    - Nested RepeaterTable

    - MilestoneNum1 (dropdown)

    - MilestoneAmount

    RepeaterTable2

    - MilestoneNum2 (dropdown)

    - MilestoneCost

    Does anyone have any ideas how to make this work right?

    Thanks in advance,

  • 07-24-2012 07:21 AM In reply to

    Re: Nested repeating tables and sum

    Is this what you're looking for?

    Mel Clemente
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 07-24-2012 09:41 AM In reply to

    Re: Nested repeating tables and sum

    Could you post this formula with the XPath expanded?

       sum(MilestoneAmount[MilestoneNum1 = MilestoneNum2])

    My guess is that you need to use current() somewhere and that the formula might have an absolute XPath instead.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-24-2012 10:53 AM In reply to

    Re: Nested repeating tables and sum

    Jimmy, yes I found the solution on another forum and it was to use current():

     sum(MilestoneAmount[MilestoneNumber1 = current()/../MilestoneNumber2])

     Thanks,

  • 02-25-2013 03:40 PM In reply to

    • DTshin
    • Not Ranked
    • Joined on 02-25-2013
    • Posts 3

    Re: Nested repeating tables and sum

    Just going back to this example, the original post mentioned that the amounts are stored in a NESTED repeating table:

    /my:RepeaterTable1/my:NestedRepeaterTable/my:MilestoneAmt (shown as the column amt)

    I've been able to replicate this solution, but is there a way to do this summary of the MilestoneAmt without creating a secondary repeating table?

    In the example here (Summary View): http://www.infopathdev.com/files/folders/examples/entry41116.aspx, there is no secondary repeating table to store the summaries,probably because it's just one level of repeating tables. (I saw an example from Greg Collins: http://www.infopathdev.com/forums/storage/39/43749/SummaryTable.xsn - two ways of doing summary table: with filters OR with conditional formatting - nice, but again doesn't have the nested repeating tables).

    And if I MUST need a secondary repeating table, is there a solution where the rows are dynamically summarized, without needing the drop down controls?

    Thanks in advance.

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