Count unique values from a secondary source (sharepoint) - 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 » Count unique values from a secondary source (sharepoint) Count unique values from a secondary source (sharepoint) Last post 12-03-2012 09:49 PM by toren78. 11 replies. Page 1 of 1 (12 items) Sort Posts: Oldest to newest Newest to oldest Previous Next 11-29-2012 06:38 AM toren78 Joined on 11-29-2012 Posts 7 Count unique values from a secondary source (sharepoint) Reply Contact I have a secondary source in Infopath 2007 filler form template, This source is from a Sharepoint list that contains many records. my requirement is to count unique records (text) in one of the columns. Example: Col a A A A B B D Should count 3. Searched all over the place but could not find a proper solution... Ideas? Thanks, Oren. Filed under: Read only 11-29-2012 07:02 AM In reply to Jimmy Joined on 07-03-2008 Posts 2,595 Re: Count unique values from a secondary source (sharepoint) Mark as Not AnswerMark as Answer... Reply Contact The general format would be this:count(repeatingGroup[field != preceding-sibling::repeatingGroup/field]) Jimmy Rishe / Software Developer / Microsoft MVPQdabra Software 11-29-2012 07:56 AM In reply to toren78 Joined on 11-29-2012 Posts 7 Re: Count unique values from a secondary source (sharepoint) Mark as Not AnswerMark as Answer... Reply Contact Jimmy, Thank you for your swift reply! I'll test it Sunday first thing and report back, Cheers, Oren 12-02-2012 02:34 AM In reply to toren78 Joined on 11-29-2012 Posts 7 Re: Count unique values from a secondary source (sharepoint) Mark as Not AnswerMark as Answer... Reply Contact Hi, The suggested method did not work. I'm getting an error that a "Node test" was expected. Also, since it is a secondary source, Infopath added this prefix to the Xpath: xdDocument:GetDom ("source name")/dfs:...... Are you able to help? Oren 12-02-2012 08:00 PM In reply to Jimmy Joined on 07-03-2008 Posts 2,595 Re: Count unique values from a secondary source (sharepoint) Mark as Not AnswerMark as Answer... Reply Contact Could you post the actual formula you wound up with? Jimmy Rishe / Software Developer / Microsoft MVPQdabra Software 12-02-2012 08:40 PM In reply to toren78 Joined on 11-29-2012 Posts 7 Re: Count unique values from a secondary source (sharepoint) Mark as Not AnswerMark as Answer... Reply Contact Sure: I tried either: count(xdXDocument:GetDom("Meetings")/dfs:myFields/dfs:dataFields/dfs:meetings/@MA[. != preceding-sibling::xdXDocument:GetDom("Meetings")/dfs:myFields/dfs:dataFields/dfs:meetings/@MA]) Or: count(xdXDocument:GetDom("Meetings")/dfs:myFields/dfs:dataFields/dfs:meetings[@MA != preceding-sibling::xdXDocument:GetDom("Meetings")/dfs:myFields/dfs:dataFields/dfs:meetings/@MA]) Thank you Filed under: unique 12-02-2012 08:46 PM In reply to Jimmy Joined on 07-03-2008 Posts 2,595 Re: Count unique values from a secondary source (sharepoint) Mark as Not AnswerMark as Answer... Reply Contact Please give this a try:count(xdXDocument:GetDom("Meetings")/dfs:myFields/dfs:dataFields/dfs:meetings[@MA != preceding-sibling::dfs:meetings/@MA]) Jimmy Rishe / Software Developer / Microsoft MVPQdabra Software 12-03-2012 05:58 AM In reply to toren78 Joined on 11-29-2012 Posts 7 Re: Count unique values from a secondary source (sharepoint) Mark as Not AnswerMark as Answer... Reply Contact Hi,This time there was no error, but the it counted all the records save for one, i.e there are 3206 records and the count was 3205.Any ideas?Cheers,Oren 12-03-2012 08:29 AM In reply to Jimmy Joined on 07-03-2008 Posts 2,595 Re: Count unique values from a secondary source (sharepoint) Mark as Not AnswerMark as Answer... Reply Contact Is there any chance there were two records with the same MA value? Jimmy Rishe / Software Developer / Microsoft MVPQdabra Software 12-03-2012 08:33 AM In reply to toren78 Joined on 11-29-2012 Posts 7 Re: Count unique values from a secondary source (sharepoint) Mark as Not AnswerMark as Answer... Reply Contact HiYes, there are many MA values which are the same,The requirement is to count only those unique MA records. 12-03-2012 08:54 AM In reply to Jimmy Joined on 07-03-2008 Posts 2,595 Re: Count unique values from a secondary source (sharepoint) Mark as Not AnswerMark as Answer... Reply Contact I see a potential issue in the formula. Please try this:count(xdXDocument:GetDom("Meetings")/dfs:myFields/dfs:dataFields/dfs:meetings[not(@MA = preceding-sibling::dfs:meetings/@MA)]) Jimmy Rishe / Software Developer / Microsoft MVPQdabra Software 12-03-2012 09:49 PM In reply to toren78 Joined on 11-29-2012 Posts 7 Re: Count unique values from a secondary source (sharepoint) Mark as Not AnswerMark as Answer... Reply Contact Jimmy,Imagine the entire Internet giving you a standing ovation right now,It worked!Thank you,Oren Page 1 of 1 (12 items) Copyright © 2003-2019 Qdabra Software. All rights reserved.View our Terms of Use.
The general format would be this:
count(repeatingGroup[field != preceding-sibling::repeatingGroup/field])
Please give this a try:
count(xdXDocument:GetDom("Meetings")/dfs:myFields/dfs:dataFields/dfs:meetings[@MA != preceding-sibling::dfs:meetings/@MA])
Hi,
This time there was no error, but the it counted all the records save for one, i.e there are 3206 records and the count was 3205.
Any ideas?
Cheers,
Oren
Hi
Yes, there are many MA values which are the same,
The requirement is to count only those unique MA records.
I see a potential issue in the formula. Please try this:
count(xdXDocument:GetDom("Meetings")/dfs:myFields/dfs:dataFields/dfs:meetings[not(@MA = preceding-sibling::dfs:meetings/@MA)])
Jimmy,
Imagine the entire Internet giving you a standing ovation right now,
It worked!
Thank you,