Counting Duplicate Values in a Repeating Table - InfoPath Dev
in

InfoPath Dev

Counting Duplicate Values in a Repeating Table

Last post 11-01-2016 04:14 PM by edgfox. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 10-16-2016 05:32 PM

    • edgfox
    • Not Ranked
    • Joined on 07-06-2016
    • Posts 7

    Counting Duplicate Values in a Repeating Table

    Hi, I have been unable to find an answer to this anywhere online. So hopefully someone here can give me a hand. I have a document generator and register. Once a document is generated by a user (just a list of questions), it is added to the register. One of the questions on the generator page is "Are there any referenced documents". If the user selects yes, the list of documents from the register is returned and the user is to select which document it references. So on the register, a document can have several documents referencing it (all have a common reference number "ParentNode"). At the press of a button on a line in the register, all documents that reference this "ParentNode" are queried and shown on the register. What I am wanting is to show on the label of the button, the number of documents that will be shown back. It seems to be a complex formula using count() and preceding-sibling. My attempt: count(xdXDocument:GetDOM("LISTNAME")//dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Title[d:ParentNode = preceding-sibling::d:SharePointListItem_RW/d:ParentNode]) But this does not work. So in words, the formula is to say on each line of the repeating table: Count the number of time this "ParentNode" from the column "Reference" is repeated in the column "Reference". Give back a single number. Appreciate any assistance. Ed
  • 11-01-2016 07:18 AM In reply to

    Re: Counting Duplicate Values in a Repeating Table

    If you are still stuck on this, can you attach a copy of your template under the options tab in a reply? I'll take a look & give you a hand.
    Hilary Stoupa

  • 11-01-2016 03:09 PM In reply to

    • edgfox
    • Not Ranked
    • Joined on 07-06-2016
    • Posts 7

    Re: Counting Duplicate Values in a Repeating Table

    Hi. Yes I am still stuck on this. I have attached a screen shot of the register as well as the template. So from the screen shot, I am wanting the "Group" button to show the number of times the relative parent node on that row is duplicated. The Group button queries the data and will return all results where the parent node is equal to the parent node of that row. But I want the user to know how many it will pull back before running the query. So the first Group button will have 6 showing on the button, as the node 'VAR-LET-0001-S' is shown 6 times in that column. The next 2 Rows will also show 6, as it is the same node. The fourth row will show the number 1, as it is the only 'COM-LET-0001-S' in that column. etc. etc. Apologies if I am not using the correct terminology. Only just starting out with InfoPath. Appreciate any help on the matter. Ed
  • 11-01-2016 03:19 PM In reply to

    Re: Counting Duplicate Values in a Repeating Table

    Sadly, the forum only allows one attachment per post, can you attach your screenshot again? Just add it under the options tab. Thanks!
    Hilary Stoupa

  • 11-01-2016 03:33 PM In reply to

    • edgfox
    • Not Ranked
    • Joined on 07-06-2016
    • Posts 7

    Re: Counting Duplicate Values in a Repeating Table

    Ahh. Try this.
  • 11-01-2016 03:44 PM In reply to

    Re: Counting Duplicate Values in a Repeating Table

     Your "Parent" node has a crazy name - I right clicked it in the data fields task pane to get the name back (SharePoint does these things to us to build character). Try this as a formula for your button label:

    count(xdXDocument:GetDOM("GL Letter Register - List")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW[d:_64ca7bf1_31d4_4bd3_84e0_9d4f841f87ea = current()/d:_64ca7bf1_31d4_4bd3_84e0_9d4f841f87ea])  

    Hilary Stoupa

  • 11-01-2016 04:14 PM In reply to

    • edgfox
    • Not Ranked
    • Joined on 07-06-2016
    • Posts 7

    Re: Counting Duplicate Values in a Repeating Table

    Yes that worked perfectly! thank you. It was much more simple than what I was trying to do. Cheers, Ed
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.