Calculate totals of a Sharepoint List repeating table - InfoPath Dev
in

InfoPath Dev

Calculate totals of a Sharepoint List repeating table

Last post 06-06-2013 05:30 AM by ErnestoM. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 06-04-2013 12:06 AM

    Calculate totals of a Sharepoint List repeating table

    Hi Guys - I was able to manage to show my sharepoint list using a repeating table that i seen in different blogs. My problem now is i can't find a way to add a total column in the footer. Im filtering the sharepoint list data in my view by hiding the rows. I just want to calculate the totals of the rows that is not hidden. Any idea?
  • 06-04-2013 05:17 AM In reply to

    Re: Calculate totals of a Sharepoint List repeating table

    I believe your sum will need to use the same filter. For example, if you're hiding rows where my:TotalHours > 0, your sum would look like this:

    sum(my:row[my:TotalHours > 0]/:my:TotalAmount)

    I'm attaching a quick sample that you can look at in Design and Preview. Hope this helps!

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


  • 06-04-2013 06:11 AM In reply to

    Re: Calculate totals of a Sharepoint List repeating table

    Thanks Ernesto for your reply,. but i can't get the correct formula, can you help? i tried using this formula below and im getting 0.0 value for Grand Total Hours, i am filtering the repeating table base on the dates, these two dates are outside of repeating table, Start Date and End Date,
    sum(xdXDocument:GetDOM("Work Order System")/dfs:myFields/dfs:dataFields/dfs:Work_Order_System[@Labor_Min_Date < /my:myFields/my:SummaryReport/my:LR_StartDt or @Labor_Min_Date > /my:myFields/my:SummaryReport/my:LR_EndDt]/@Labor_Hours_Total)

  • 06-05-2013 05:17 AM In reply to

    Re: Calculate totals of a Sharepoint List repeating table

    I would suggest trying intermediate steps to slowly build your total sum. So if your goal is to fulfill two conditions in the sum, perhaps start off with

    sum(xdXDocument:GetDOM("Work Order System")/dfs:myFields/dfs:dataFields/dfs:Work_Order_System[condition #1]/@Labor_Hours_Total)

    then try

    sum(xdXDocument:GetDOM("Work Order System")/dfs:myFields/dfs:dataFields/dfs:Work_Order_System[condition #2]/@Labor_Hours_Total)

    Once the two above work OK, it seems like you would just need to add one to the other.

    Hope this helps!

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


  • 06-05-2013 05:50 AM In reply to

    Re: Calculate totals of a Sharepoint List repeating table

    Thanks Ernesto, i tried both but still the output is zero, i think your sample is not applicable for data that is coming from a Sharepoint List.
    I tried this but still no luck
    sum(xdXDocument:GetDOM("Work Order System")/dfs:myFields/dfs:dataFields/dfs:Work_Order_System[number(translate(translate(translate(@Labor_Min_Date,'-',''),' ',''),':','')) > number(translate(translate(translate(/my:myFields/my:SummaryReport/my:LR_StartDt,'-',''),' ',''),':',''))]/@Labor_Hours_Total)
  • 06-05-2013 11:56 AM In reply to

    Re: Calculate totals of a Sharepoint List repeating table

     Have you tried summing without a condition?

    sum(xdXDocument:GetDOM("Work Order System")/dfs:myFields/dfs:dataFields/dfs:Work_Order_System/@Labor_Hours_Total)

    Does that work OK?

    I guess I'm trying to figure out if the xpath is incorrect or if the condition is incorrect, or if there's a problem in the data that prevents it from being summed.

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


  • 06-05-2013 10:47 PM In reply to

    Re: Calculate totals of a Sharepoint List repeating table

    Yes it works without condition during preview. i attached the screenshot. totals of all items were pulled, not the correct total because we dont have condition.
    sum(xdXDocument:GetDOM("Work Order System")/dfs:myFields/dfs:dataFields/dfs:Work_Order_System/@Labor_Hours_Total)
  • 06-05-2013 11:44 PM In reply to

    Re: Calculate totals of a Sharepoint List repeating table

    Thanks Ernesto i got it working now. :)

    sum(xdXDocument:GetDOM("Work Order System")/dfs:myFields/dfs:dataFields/dfs:Work_Order_System/@Labor_Hours_Total[msxsl:string-compare(../@Labor_Min_Date, xdXDocument:get-DOM()/my:myFields/my:SummaryReport/my:LR_StartDt) >= 0 and msxsl:string-compare(../@Labor_Min_Date, xdXDocument:get-DOM()/my:myFields/my:SummaryReport/my:LR_EndDt)
  • 06-06-2013 05:30 AM In reply to

    Re: Calculate totals of a Sharepoint List repeating table

    Awesome!

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


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