Limit repeating table row count on query value return - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Limit repeating table row count on query value return

Last post 04-29-2022 04:56 PM by Hilary Stoupa. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 04-21-2022 10:31 AM

    Limit repeating table row count on query value return

    Hello everyone, I'm fairly new to InfoPath and I've created a form that tracks interactions our leadership team has with our representatives. It tracks data such as what type of interaction it is, the date of the interaction and various other data.

    I've recently included a query that displays the employees interactions with our team when you enter their employee ID. I'm using a data connections "dataFields" repeating table to return the values specific to the employee ID. This works perfectly and it displays all the interactions we've had with that representative, and I was looking for a way to have that query return ONLY the 10 most recent interactions.

    I found this https://www.infopathdev.com/forums/p/2425/9807.aspx as a way to get the result that I wanted, however this only worked in InfoPath filler, and not on the SharePoint site where the form is located. I used Hilary's recommended method.

    Any guidance is appreciated, as I have been searching for a way to make this work for quite some time now as we don't want a large list returned and only really need their most recent entries. I've attached an image of my issue.
  • 04-21-2022 10:40 AM In reply to

    Re: Limit repeating table row count on query value return

    I think your best approach may be to use the SharePoint REST API instead, or the list data svc, depending on your SharePoint version. Then you can just get the top 10 most recent rows returned for a given ID. Let me know what version of SharePoint you are using and I can help you with this. :)
    Hilary Stoupa

  • 04-21-2022 05:27 PM In reply to

    Re: Limit repeating table row count on query value return

    Hi Hilary and thank you for your quick response. We are using SharePoint 2013, and I've never used REST API so I'd have to look a bit more into that.

    I was hoping there was something in infopath that I could use, but I do enjoy the learning aspect of my role.
  • 04-22-2022 07:53 AM In reply to

    Re: Limit repeating table row count on query value return

    In InfoPath we can create connections to REST services, and then we have the ability to change the REST URL as a rule action. There are sometimes SharePoint settings that need to be modified for these queries to work in the browser. You can work out the correct URL in your browser to make sure you have the right URL before adding the connection. You might try: YourSiteURL/_api/web/lists/GetByTitle('YourListTitle')/items to begin with, just to verify that the REST API returns data - obviously replacing the placeholders. Check that first, in your browser, and then I can help you with the filters, sorting, and limiting the returned rows. :)
    Hilary Stoupa

  • 04-22-2022 09:40 AM In reply to

    Re: Limit repeating table row count on query value return

    You're amazing Hilary, when I checked that URL I did get a data return in the form of text that shows raw data that is submitted in the form.
  • 04-22-2022 09:53 AM In reply to

    Re: Limit repeating table row count on query value return

    Excellent! So, at the end of the query, you can add a filter, and so forth. Here's an example that will return the first 10 items where the ID field is greater than 1: YourSiteURL/_api/web/lists/GetByTitle('YourListTitle')/items?$filter=ID ge 1&$top=10 For your InfoPath Form, you need to figure out how to get the items that match on Employee ID, right? Look at the data returned in the browser, and you can figure out the internal name of the column. The filter might look like: $filter=Employee_x0020_ID eq 10 for example. Then we can add an order operation, so that you are getting the 10 most recent - something like: YourSiteURL/_api/web/lists/GetByTitle('YourListTitle')/items?$filter=Employee_x0020_ID eq 10&$top=10&$orderby=Modified desc
    Hilary Stoupa

  • 04-29-2022 10:32 AM In reply to

    Re: Limit repeating table row count on query value return

    Thank you for your guidance on this one Hilary, I appreciate the support.

    This is off topic for this thread so I apologize if I should maybe start a new one for this question. But I have been searching for a way to query for the user who's unique ID shows up most frequently, but I can't seem to find a way to do this. Not sure if it's even possible through infopath honestly. My goal is to be able to identify which employee has the most interactions based off of his employee ID and do a count(employeeID), or maybe even a top 5 employees query.
  • 04-29-2022 04:56 PM In reply to

    Re: Limit repeating table row count on query value return

    So - this is a query to the same list, and you want to know who is in the list most often? Unfortunately, the REST API doesn't offer any aggregation, so that isn't helpful...Off-hand, I can't think of a way to do this. But it is the end of the day on Friday and my brain is empty. If I think of anything I'll let you know! :)
    Hilary Stoupa

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