Display unique values in InfoPath repeating table bound to SharePoint list - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Display unique values in InfoPath repeating table bound to SharePoint list

Last post 05-31-2016 07:28 AM by Jayne. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 05-24-2016 07:09 AM

    • Jayne
    • Not Ranked
    • Joined on 02-08-2016
    • Posts 12

    Display unique values in InfoPath repeating table bound to SharePoint list

    Hi,  

    I have a SharePoint 2013 list that houses our training enquiries.  Each item in the list is an individual student.  Amongst other columns, there is a part number constructed from the student's region and department.  There can be up to 6 students on each class, these are linked by a unique reference number. 

    I am trying to create an InfoPath 2010 form to use as a Purchase Requisition.  I have a field where the reference number is typed in, then a button which is clicked.  Rules on the button set a query field and then query the data source.  This populates a repeating table that is bound to the SharePoint list with one line for each student. 

    My problem is that all 6 of these students might have the same part number.  In that case I would want only 1 line in my table with a quantity of 6.  Or there might be 3 with one part number and 3 with another part number.  In which case I want to see 2 lines, each with a quantity of 3. 

    Using 'preceding' to filter the data I can get it to show the first item and count for that item but I cannot get it to show the remaining items - the repeating table only has one line. 

    XPath is as follows:

    To get part number: = pART_x0020_NUMBER[not(. = preceding::SharePointListItem_RW/pART_x0020_NUMBER)] 

    To get count: count(pART_x0020_NUMBER[not(. = preceding::SharePointListItem_RW/pART_x0020_NUMBER)]) 

    I have searched and searched for an answer but nothing seems to work.  I don't understand what the preceding function is doing so I don't know if it is really the right thing, but it seemed to feature in a lot of the posts I found. 

    I am not allowed to use code and have very little IS support when it comes to InfoPath.  Any help would be gratefully received, I am starting to think this is too complex a requirement for InfoPath. 

    Thanks in advance,

    Jayne 

     

  • 05-24-2016 05:46 PM In reply to

    Re: Display unique values in InfoPath repeating table bound to SharePoint list

    Here's a sample that isn't a SharePoint list form, but hopefully the formulas used will help you. You can attach your form in a reply under the Options tab if you need assistance implementing this. :) Save the sample locally, right click and select design to open, then you can preview & try it out.
    Hilary Stoupa

  • 05-25-2016 02:14 AM In reply to

    • Jayne
    • Not Ranked
    • Joined on 02-08-2016
    • Posts 12

    Re: Display unique values in InfoPath repeating table bound to SharePoint list

    Hi Hilary,

    Thanks for your quick reply.  I have looked at your file and tried to recreate it using my data.  I am having some trouble though, I have attached my form.

    The top bit does what I expect it to do.  I fill in my reference click the button and it retrieves the necessary information form the SP list into the repeating table. (3 lines, two different part numbers). 

    The second table I have inserted is where I am trying to replicate what is on your form.  The first field is picking up the first part number, but it doesn't pick up any others which are different.  I have tried to get the count field working but keep getting the error, 'does not point to a valid location path of a field or group'.  The XPath below is what I am trying to use.     

    Count(/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW[d:pART_x0020_NUMBER = current()/d:pART_x0020_NUMBER])

    The form isn't the SP list form but a separate form that is just using the data from the SP list.  Initially it will be emailed to people for approval but the ultimate goal is to attach it to an approval workflow. 

    Thanks,

    Jayne  

  • 05-25-2016 08:06 AM In reply to

    Re: Display unique values in InfoPath repeating table bound to SharePoint list

    Oh - were you hoping to copy the data from the SharePoint list into the main data source? I ask because I see your second repeating table is bound to the main data source... InfoPath won't do that out of the box. Is it okay to just display data from the secondary data source instead?
    Hilary Stoupa

  • 05-25-2016 08:19 AM In reply to

    • Jayne
    • Not Ranked
    • Joined on 02-08-2016
    • Posts 12

    Re: Display unique values in InfoPath repeating table bound to SharePoint list

    I only need to display the data, we won't be changing or adding to the data from this form. Binding the table to the secondary data source was the only way I'd found of bringing in more than one list item. If I use rules to set field values it only seems to bring in the first entry.

  • 05-25-2016 08:56 AM In reply to

    Re: Display unique values in InfoPath repeating table bound to SharePoint list

     I've attached your form w/ some changes that I think do what you want. I put a second instance of the repeating table from the secondary data source on the form and added a formatting rule and a calculated value w/ the count formula. I also added a form load rule to run the query for that secondary data source again if this is a saved form being reopened.

    Hilary Stoupa

  • 05-26-2016 04:56 AM In reply to

    • Jayne
    • Not Ranked
    • Joined on 02-08-2016
    • Posts 12

    Re: Display unique values in InfoPath repeating table bound to SharePoint list

    Hilary, thank you so much!! This is exactly what I'm trying to achieve! 

    Funnily enough the xpath you've used is exactly what I was trying to do yesterday so I don't get why it wouldn't work for me!  I have managed to replicate what you have done so I think I might finally be there.

    Thank you so, so much for taking the time to help.  I have been pulling my hair out over this for months and I think it's now solved.  You are an absolute star!!


      

  • 05-26-2016 07:39 AM In reply to

    • Jayne
    • Not Ranked
    • Joined on 02-08-2016
    • Posts 12

    Re: Display unique values in InfoPath repeating table bound to SharePoint list

    One more question on this matter.  Is it possible to display each of the student names under or alongside the relevant part number?  For example

    Part: 123456  Count: 2  Students: Fred, Bob

    Part: 234567  Count: 1  Student: Sally

    Thanks again! 

  • 05-26-2016 08:10 AM In reply to

    Re: Display unique values in InfoPath repeating table bound to SharePoint list

    Yes, I'd think so, probably need to use a double eval to concat the students together. I've given this a shot in the attached copy of your form....
    Hilary Stoupa

  • 05-31-2016 07:28 AM In reply to

    • Jayne
    • Not Ranked
    • Joined on 02-08-2016
    • Posts 12

    Re: Display unique values in InfoPath repeating table bound to SharePoint list

    Hi Hilary,

    That's perfect.  Thank you so much for your help, I think my form now does everything I want it to do!  

     Jayne 

Page 1 of 1 (10 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.