Auto-populate the input form(Infopath2010) with the most recent item of the list. - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Auto-populate the input form(Infopath2010) with the most recent item of the list.

Last post 10-27-2014 07:56 AM by Abe_J. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 05-15-2012 08:25 PM

    Auto-populate the input form(Infopath2010) with the most recent item of the list.

    Hi, I m working on the Infopath2010 form, it is an input form. What I want to achieve is everytime when I click on "Add new item" from the list, the form will be opened with filled information which duplicated from the most recent item of the list(last entry I made), all I need to do is to alter it, and save it as the new item, because most of time, this month's entry wont be too much different from last month. is that achievable? Thanks a lot in advance.

  • 05-16-2012 09:19 AM In reply to

    Re: Auto-populate the input form(Infopath2010) with the most recent item of the list.

    Hi - so this is a SharePoint list form, right? You can add another data connection to the same list.... then query to get the items, and use rules to copy the data in.

    I think I'd add two data connection. One to just return the list item IDs. Then another to return the full details of a list item. The one that returns list item IDs, I'd let that run when the form loads. For the connection that returns the full details, I would use form load rules to do the following:

    1. Set the query field named ID to the max ID from the data connection that runs when the form opens
    2. Run the query that returns the full details for the item with the max ID (that will be the most recent one)
    3. Use rules to set the fields in the form to the values from the data connection that was just populated by the query

    Hope that makes sense - let me know if you need more detail.

    Hilary Stoupa

  • 05-18-2012 12:15 AM In reply to

    Re: Auto-populate the input form(Infopath2010) with the most recent item of the list.

    Thanks a lot, yes, I need a bit of more details.

    A. List item IDs: off the topic, but interesting to know, I can see it from Infopath form, under fields, but no such colum called ID under list settings. Is the ID always automatically generated everytime a new item s added? where is the column named ID hidden?

    B: I can get step1 and 2 work. Here s the details for ppl have the same issues as me, set up two DC(data connection), name one as "ID"  which is the 2nd DC, only need ID returns. The other one, just use "main data connection", everything returns. Set up the rule when form load, action 1: set a field value: field is the main DC's data field ID, value is the 2nd DC "ID" query field ID at Max. action 2: query for a data on the main DC. At this point, I m able to click on "add new" and bring up a form filled with the most recent item details.

    C: Got lost on step3. I think this is the step which let me copy the queried data(the most recent entry) to the new entry. But it ends up I edit on the most recent item and save it, not create a new and copy the most recent one in, edit and save it.

    Anything I m missing?

    Cheers!

  • 05-18-2012 08:30 AM In reply to

    Re: Auto-populate the input form(Infopath2010) with the most recent item of the list.

    If you go to edit a view in your list, you'll see the ID. All list and library items in SharePoint have an ID - it is an auto-incrementing identity column and unique per list / library (i.e., in a given list, there will only be one item "1" and the id will never be re-used if the item is deleted).

    Your item B above sounds not quite right to me.

    Your form should have 3 data connections.

    1. The main data connection
    2. The data connection to return all IDs from the list
    3. Another data connection to the same list that returns all fields and doesn't run on load.

    You will then:

    1. Execute data connection 2 on load
    2. Set the Query field for the ID in data connection 3 to the max ID from data connection 2
    3. Query with data connection 3
    4. Use rules to populate fields in the Data fields in data connection 1 with values from data connection 2

    It sounds to me that instead you are currently querying the main data connection for a given ID, which means you will simply be updating an existing item rather than creating a new item.

     

     

    Hilary Stoupa

  • 05-24-2012 12:50 AM In reply to

    Re: Auto-populate the input form(Infopath2010) with the most recent item of the list.

    Hi, Hilary

    I gotcha, the step 4, I think it was a typo, you meant "use rules to populate fields in the data fields in data connection with values from data connection 3". not connection 2(the ID one).

    But I got a new problem. There are more than one contributors for the list, whoever open the form, always open up the most recent item, even it is from the different user, how do I make it open up the most recent item ONLY from the current user.

    I guess I have to do something with the filter on your step 4, but I dont know how to set the filter up,  I can pick up current user's UserName(login). but how to make the connection between the "login" and "created by".

    There are some pieces missing in the puzzle. Can you help me with it?

    Thanks and best regards

  • 05-24-2012 07:32 AM In reply to

    Re: Auto-populate the input form(Infopath2010) with the most recent item of the list.

    Yes! You are right, that is what I meant - sorry about that.

    I guess what I'd do is add the created by field to the data connection (data connection 2, with the ID) and drag the data fields onto the form and preview to see what Created By looks like when returned by SharePoint to InfoPath. That will at least help you see what the information you have to query with looks like....

    Hilary Stoupa

  • 05-25-2012 02:08 AM In reply to

    Re: Auto-populate the input form(Infopath2010) with the most recent item of the list.

    Hi, Hilary

    Thanks for your reply again, tried the data connection 2(ID), datafields/created by/pc:person/DisplayName, only showed a repeating section, with a long list got my name(I m the current user) and my boss' name on it. if Account ID, will be my login and my boss' login.

    Cheers

  • 05-29-2012 10:44 AM In reply to

    Re: Auto-populate the input form(Infopath2010) with the most recent item of the list.

    I'm sorry, I just don't understand. Can you maybe attach a screenshot under the Options tab to help me?

    Hilary Stoupa

  • 10-27-2014 07:56 AM In reply to

    • Abe_J
    • Not Ranked
    • Joined on 10-21-2014
    • Posts 1

    Re: Auto-populate the input form(Infopath2010) with the most recent item of the list.

    Hilary,

    I know this is an old thread, but it is what I'm looking for, as answers go.

    I have the data connections, but what I'm confused about is how to set the form values. If you could possibly give a rule example for at least one field that'd be great.

    My form needs to populate the most recent record of our hardware inventory. Here are the fields that need to be populated:

    School (dropdown list box)

    Building (dropdown list box)

    Classroom (dropdown list box)

    Make/Model # (dropdown list box)

    Serial # (text box)

     My coworker and I will be inputting thousands of records that were recently lost from a server a couple months ago. I am fairly new to Infopath, but I went to school for the back end of these programs, so it's a slight change. I understand for the most part of how everything works, but every program is different. So a slight kick in the right direction would be great. Thanks in advance!

    Abe

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