XPath: Count distinct values in repeating table - InfoPath Dev Sign in | Join | Help in General InfoPath (Entire Site) InfoPath Dev InfoPath Dev is dedicated to bringing you the information and tools you need to be successful in your Microsoft Office InfoPath development projects. Home Blogs Forums Photos Downloads InfoPath Dev » InfoPath » General » XPath: Count distinct values in repeating table 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: Oldest to newest Newest to oldest Previous Next 11-28-2007 11:50 PM zaphi Joined on 01-09-2006 Switzerland Posts 82 XPath: Count distinct values in repeating table Reply Contact HiI 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 Karsten Brocksieper Joined on 02-07-2006 Germany Posts 220 Re: XPath: Count distinct values in repeating table Mark as Not AnswerMark as Answer... Reply Contact 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 anotherchrisberry Joined on 03-30-2006 USA Posts 39 Re: XPath: Count distinct values in repeating table Mark as Not AnswerMark as Answer... Reply Contact 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 Joined on 01-09-2006 Switzerland Posts 82 Re: XPath: Count distinct values in repeating table Mark as Not AnswerMark as Answer... Reply Contact 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.
HiI 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
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,
you can use a simple xpath like this:
count(row[not(preceding::row = .)])
that will give you the count of distinct values.
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