Locate the last item within a Sharepoint List - InfoPath Dev
in

InfoPath Dev

Locate the last item within a Sharepoint List

Last post 09-30-2013 09:19 AM by Jimmy. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-29-2013 05:38 AM

    Locate the last item within a Sharepoint List

    I have a simple development request form (Infopath 2010) that contains a few dates (today) and a review date, three text boxes (Previous Development, Development Review and Next Development) plus a few other rating options, user ID and Manager These are completed by trainees (users) and added to a Sharepoint 2010 list, producing a list with many entries, several from each of the managers involved. I have set up a data connection and can extract a field from an entry, but I want the LAST entry that a specific manager submitted for a specific user (using username() ) for the user, and manager field. How do I find the last of several such entries? I can pick the manager and the user from previously submitted forms, but ideally I want to select the development activities from the LAST form of a particular manager and user. I cannot rely on the review date being before the actual review takes place, nor within a fixed time period i.e. normally the review should be conducted with one month of the start date, and before the review date agreed on the form. Any thoughts or advice? Leslie
  • 09-29-2013 10:33 PM In reply to

    Re: Locate the last item within a Sharepoint List

    Could you give us screenshots of your list data source to give us some idea of its layout? Is the data connection sorted such that later submitted items appear later in the data connection. Would you be amenable to having it sorted so that later items occur FIRST? That may be easier to work with.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 09-30-2013 05:13 AM In reply to

    Re: Locate the last item within a Sharepoint List

    sorry - struggling to see how to upload the screenshot - hope this helps??

    the item name will be something like below. Each manager (Leslie, Simon, etc.) the month (probably full date) and employeeID

    The form, if I could upload it, has an agreed Development text field where the manager and employee agree a simple development goal. The Reviewed and Prompt on the first form, for each manager/employee combination is blank.

    When the manager opens the second form for an employee the Prompt is filled from the previous form, hence Excel Basic for Oliver's second form, Project Management for Andrea, etc. A manager may have several employees which will eventually be filtered for reporting purposes, and this I can do already.

    The list can be ordered in any format, I was assuming they would be in name order, as shown below, although I can see that the Name_Date_Employee may become Name_Employee_Date to ewase the grouping, this can be done easily.

    I can connect to the Sharepoint list and use the employee and manager to identify the correct forms (filter), but cannot ensure I have selected the LAST form, which will have the latest date, and be last in the list for any particular manager/employee combination.

    Today() will always be after the Date field, but not always before the Reviewed date field, so I cannot use the date as a filter.

    Name Manager Employee Date Review Development Prompt Reviewed
    Julie_Jan_Pe Julie Peter 14-Jan 23-Feb Finance for non-Finance    
    Julie_Feb_Pe Julie Peter 19-Feb 15-Mar Excel Basic Finance for non-Finance Not Useful
    Leslie_Jan_Mi Leslie Michael 10-Jan 12-Feb Excel Basic    
    Leslie_Feb_Mi Leslie Michael 13-Feb 03-Mar Excel Intermediate Excel Basic Not useful
    Leslie_Mar_Mi Leslie Michael 01-Mar 04-Apr PowerPivot Excel Intermediate Useful
    Leslie_Jan_Ol Leslie Oliver 02-Jan 01-Feb Excel Basic    
    Leslie_Feb_ol Leslie Oliver 03-Feb 10-Mar Powerpoint Excel Basic useful
    Leslie_Mar_ol Leslie Oliver 20-Mar 03-Apr Drawing Powerpoint Excellent
    Mary_Jan_Ba Mary Barry 21-Jan 01-Mar Influencing Skills    
    Mary_Feb_Ba Mary Barry 16-Feb 10-Mar Negotiation Influencing Skills Excellent
    Mary_Mar_Ba Mary Barry 03-Mar 12-Apr Conflict handling Negotiation Excellent
    Simon_Jan_An Simon Andrea 02-Jan 10-Feb Project Man    
    Simon_Feb_An Simon Andrea 26-Mar 03-Apr Word Project Man Excellent
    formula for filename Text Text Date Date Text Development from previous Text
  • 09-30-2013 09:19 AM In reply to

    Re: Locate the last item within a Sharepoint List

     Hello again,

    If you've already figured out how to identify which rows belong to the employee/manager combination you want, I think you just need to modify your data connection to sort descending on whichever column you are using to determine the order (probably either Date or ID). Then when you use a filtered path to get the value, something like:

     SharePointListItem_RW[Manager = Manager and Name = username()]/Prompt

    that should retrieve the value you want, the first match, since the values are sorted in reverse.

    Note that you don't have to change the ordering of your list to do this, just the sorting in the data connection.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.