Is it possible to pull the sum of a field in a repeating table? - InfoPath Dev
in

InfoPath Dev

Is it possible to pull the sum of a field in a repeating table?

Last post 01-22-2016 03:41 PM by Hilary Stoupa. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 01-21-2016 07:55 AM

    Is it possible to pull the sum of a field in a repeating table?

     So for instance. I have a drop down box, and shows any (line item/row in a list) that only shows items that have a field with a value equal to the value in the drop down box. which I want the sum of a field in the repeating table to show up in a non repeating tale field "total"

     I tried creating a rule on the table itself saying:

    Condition: None - Rule runs when field is changed

    Run These Actions:

    Query for data - Main data Connection

    Set a fields value: "total" formula: sum(Price) 

    When I pick the drop down, I get all my lines/rows that match the drop down field, but my "total" field stays blank no matter what I try...

     

     

    Edit: I did try to just set a default value to the Total field but when I do that my drop downs don't work which is super odd... 

     

    Any help would be greatly appreciated. 

     

  • 01-21-2016 11:52 AM In reply to

    Re: Is it possible to pull the sum of a field in a repeating table?

    Wouldn't the rule be on the drop down box? When a data source is first queried, rules won't run on its fields (they haven't "changed" - which is what fires a rule - InfoPath considers the loading of data not be a change to that data).
    Hilary Stoupa

  • 01-21-2016 12:48 PM In reply to

    Re: Is it possible to pull the sum of a field in a repeating table?

     Hilary,

     

    I moved the rules to the drop down and the rules seem to work.

     

    so first rule is:  

    None - Rule runs when field changes

    Actions:

    set fields value Ordered Quantity * Price

     

    Then second rule is:

    If ParentID = to the drop down then make total show the sum of the field with the default value of   Ordered Quantity * Price

     

    BUT it seems to be showing all line item totals even though I have the "If ParentID = to the drop down" 

     

     

    I guess the question would be how can I say in a formula (Only give me the sum of all the fields linetotals which have the default value "Ordered Quantity * Price) but only for the rows where the ParentID is equal to my Dropdown. 

  • 01-22-2016 12:59 PM In reply to

    Re: Is it possible to pull the sum of a field in a repeating table?

     Is there a way to only show the sum of a field in a repeating table for only rows that are "visible"?

     

    I cant seem to find any info on it, only excel and access results, just figured you guys/gals would be my best hope. 

  • 01-22-2016 02:03 PM In reply to

    Re: Is it possible to pull the sum of a field in a repeating table?

    Sorry, I forgot to get back to you yesterday! When you add your sum, you need to include a filter. I'll put a quick sample together (using an XML data source, so you can try it in preview and see how it works). I'll have something for you shortly.
    Hilary Stoupa

  • 01-22-2016 02:16 PM In reply to

    Re: Is it possible to pull the sum of a field in a repeating table?

    Here's a sample for you to check out. Save the file locally, right click and select Design, from there you can preview, etc.
    Hilary Stoupa

  • 01-22-2016 02:31 PM In reply to

    Re: Is it possible to pull the sum of a field in a repeating table?

     How were you able to get that text box without it being mapped to anything to put the expression in it?

     

    I see how it works, but not sure where you found that box? I'm forced to pick like text or dropdown and then it created a field on the right which id rather not have like yours... 

  • 01-22-2016 02:37 PM In reply to

    Re: Is it possible to pull the sum of a field in a repeating table?

    It is a calculated value control. You just enter your formula. :)
    Hilary Stoupa

  • 01-22-2016 02:40 PM In reply to

    Re: Is it possible to pull the sum of a field in a repeating table?

    Here's a screenshot.
    Hilary Stoupa

  • 01-22-2016 02:54 PM In reply to

    Re: Is it possible to pull the sum of a field in a repeating table?

     Tried to use the same formula as you... and got this.

     

    "dfs:dataFields/my:SharePointListItem_RW/my:LineItemTotal/dfs:dataFields/my:SharePointListItem_RW/my:ParentID" does not point to a valid location path of a field or group. 

     

    I attached the form, I'm trying to do: sum(LineItemTotal[ParentID=REQselect])

     

    Now all fields are from the repeating table but the REQselect... 

  • 01-22-2016 03:08 PM In reply to

    Re: Is it possible to pull the sum of a field in a repeating table?

     Your form is a little confusing to me since REQselect is a query field - but this seems to not give an error in a calc'd value: sum(dfs:dataFields/my:SharePointListItem_RW/my:LineItemTotal[../my:ParentID = ../../../dfs:queryFields/q:SharePointListItem_RW/q:REQselect])

    Hilary Stoupa

  • 01-22-2016 03:32 PM In reply to

    Re: Is it possible to pull the sum of a field in a repeating table?

     Your my hero! haha it works! :D thanks so much!!! I guess my xpath was wrong. Thousand thank yous!!!

  • 01-22-2016 03:41 PM In reply to

    Re: Is it possible to pull the sum of a field in a repeating table?

    Fantastic, I'm glad you have it working!
    Hilary Stoupa

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