Count unique values from a secondary source (sharepoint) - InfoPath Dev
in

InfoPath Dev

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: Previous Next
  • 11-29-2012 06:38 AM

    Count unique values from a secondary source (sharepoint)

    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:
  • 11-29-2012 07:02 AM In reply to

    Re: Count unique values from a secondary source (sharepoint)

    The general format would be this:

    count(repeatingGroup[field != preceding-sibling::repeatingGroup/field])

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 11-29-2012 07:56 AM In reply to

    Re: Count unique values from a secondary source (sharepoint)

    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

    Re: Count unique values from a secondary source (sharepoint)

    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

    Re: Count unique values from a secondary source (sharepoint)

    Could you post the actual formula you wound up with?
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-02-2012 08:40 PM In reply to

    Re: Count unique values from a secondary source (sharepoint)

    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:
  • 12-02-2012 08:46 PM In reply to

    Re: Count unique values from a secondary source (sharepoint)

    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 MVP
    Qdabra Software
  • 12-03-2012 05:58 AM In reply to

    Re: Count unique values from a secondary source (sharepoint)

    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

    Re: Count unique values from a secondary source (sharepoint)

    Is there any chance there were two records with the same MA value?
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-03-2012 08:33 AM In reply to

    Re: Count unique values from a secondary source (sharepoint)

     Hi

    Yes, 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

    Re: Count unique values from a secondary source (sharepoint)

    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 MVP
    Qdabra Software
  • 12-03-2012 09:49 PM In reply to

    Re: Count unique values from a secondary source (sharepoint)

    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.