XPath: Count distinct values in repeating table - InfoPath Dev
in

InfoPath Dev

XPath: Count distinct values in repeating table

Last post 12-03-2007 12:56 AM by zaphi. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 11-28-2007 11:50 PM

    • zaphi
    • Top 150 Contributor
    • Joined on 01-09-2006
    • Switzerland
    • Posts 82

    XPath: Count distinct values in repeating table

    Hi
    I need to count the distinct values of a field in a repeating table, which contains the name of a person
    Example:
    row1: Name = "Smith"
    row2: Name = "Bird"
    row3: Name = "Smith"
    row4: Name = "Walker"

    count of distinct values: 3

    Can anybody tell me, how I can manage that with XPath.
    Thanks a lot.
    Best regards.
    Philippe

    Infopath 2007/SP2
  • 11-29-2007 12:34 AM In reply to

    Re: XPath: Count distinct values in repeating table

    Hello,

    even if the following article by Tim Pash is not regarding a repeated table --- but maybe the technique can be helpful for you to accomplish your task...

    Please have a look at: http://blogs.msdn.com/timpash/archive/2005/11/23/XPATH-Filtering-Distinct-Values.aspx

    HTH,

     

    Karsten
  • 11-30-2007 02:26 PM In reply to

    Re: XPath: Count distinct values in repeating table

    you can use a simple xpath like this:

    count(row[not(preceding::row = .)])

    that will give you the count of distinct values. 

  • 12-03-2007 12:56 AM In reply to

    • zaphi
    • Top 150 Contributor
    • Joined on 01-09-2006
    • Switzerland
    • Posts 82

    Re: XPath: Count distinct values in repeating table

    Hi Chris,
    Your solution is very good. Thank you very much!

    here my sample:
    count(../my:gruppe1/my:gruppe2/my:feld2[not(preceding::my:gruppe2/my:feld2 = .)])

    Best regards
    Philippe

    Infopath 2007/SP2
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.