Accessing the last node in a Repeating Table - InfoPath Dev
in

InfoPath Dev

Having trouble finding a blog or post that answers your question? Check out our Custom Search Page

Accessing the last node in a Repeating Table

Last post 10-01-2012 09:39 PM by LeslieAD. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 08-13-2012 02:59 AM

    Accessing the last node in a Repeating Table

    I am sure this has been solved numerous times, I just can't find the solution I want

    Consequently I have implemented a work around based on my web searching, which I now offer to others in the hope that someone (Hilary :-) ) will finalise what I want to do.

    Background

    I have a simple form with a single 3 column Repeating Table - Name, DateOfJoining and Age (as a simple example). Once a number of rows have been entered the resulting SharePoint List concatenates the fields - so Name now consists of all the Names, DateOfJoining all the entries, etc. Other items in the List also have the same structure.

    If I want to extract the last entry (the last person to join), I have usually exported the list to Excel, used Text-to-Column and removed the surplus data manually - NOT the ideal solution.

    The work-around I have now used is to add a text field for each column in the Repeating Table I want to include in a report and then used a function to copy the last entry into the text field so that when the form is saved the last Repeating Table entry is available via the textbox contents.

    The function is based on Alec Pojidaev's original blog http://alecpojidaev.wordpress.com/2010/01/07/accessing-previous-rows-in-repeating-group-for-browser-enabled-forms/

    /my:myFields/my:Details/my:Table[count(following-sibling::*[local-name() = "Table"]) = 0]/my:Name  - where Name is one of the field names I want to copy. Change this to DateOfJoining and Age for the other text boxes

    save the fields in the SharePoint List and I have access to the relevant data. I don;t want to use the date as the differeniator as in other tables it will not be a numeric or date data type.

    Now the challenging bit - for me at least

    Eventually I want to add the SharePoint List to a new form as a Secondary Source, which I have already done and can see all the relevant fields, but I cannot change the above function to extract the last entry in each field

    the XPath for the Secondary Source is  -   /dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Name  so I guessed it was a matter of substituting the relevant myFields etc from one XPath to the other???

    didn't work though - hence this posting

    So essentially what I would like to do with OOTB infopath 2010 is to include a Secondary Source which is a SharePoint List which includes a Repeating Table and extract only the last field of certain nodes within the Repeating Table.

    Help

  • 08-13-2012 05:10 AM In reply to

    Re: Accessing the last node in a Repeating Table

    LeslieAD:
    didn't work though - hence this posting

     Could you be more specific when you say "didn't work"?

    Jimmy Rishe / Software Developer / InfoPath MVP
    Qdabra Software
  • 08-26-2012 02:52 AM In reply to

    Re: Accessing the last node in a Repeating Table

    Hi Jimmy - sorry for the slow reaponse - I have been away on leave and just back

     "didn't work" - what I was hoping to do was to copy the last completed entry in a Repeating Table from one Form into an appropriate structure (same number of columns) on a different Reporting Form using a Secondary Connection. At present when I link the table through the Secondary Connection I get the concatenated cell contents for each column, and not the contents of the last row.

    I have a SharePoint List with a number of employees ongoing monthly performance reviews. Each employee has the monthly data in their repeating table which has a number of columns (Date, Status, Progress, etc.). Throughout the year the RT will grow and I want to recall on a simple Reporting Form the last reviewed activity. It should be the same month for each employee, however some managers may be late completing their update!

    One solution is to save the last RT row in a matching set of text boxes, and copy those across the Secondary Source - which works and I can prevent an empty row of the RT from producing a null reply.

    Another solution which could/would be more elegant is to actually extract the last row from the RT to the shortened Reporting Form.

     does that help???

  • 10-01-2012 09:39 PM In reply to

    Re: Accessing the last node in a Repeating Table

    solved - well a work around has been implemented

    On the form with the Repeating Table I set up a couple of sets of extra hidden text boxes, copy the last RT row into the text boxes and promote the fields intothe sharepoint library.

    I use two sets of additional fields so that if the last row of the RT is not comlpeted I don't lose the original "last row" before the form is finally submitted.

    I can access the library fields through a data connection, so problem......solved

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