Get and save Sharepoint data into form template - InfoPath Dev
in

InfoPath Dev

Get and save Sharepoint data into form template

Last post 03-21-2007 08:53 AM by Matt Faus. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-20-2007 02:40 PM

    • pluto007
    • Not Ranked
      Male
    • Joined on 03-16-2007
    • Norway
    • Posts 4

    Get and save Sharepoint data into form template

    Hi all, I need assistance on the following scenario:

    I populate data from a SPS2 doc library view (sorted and filtered) to a repeating table in a Infopath form template. The 2ds is defined as XML file type.

    I want two things to work:
    1. When a new form template is opened by a user in SPS2 Form Library (where my form template is published) the table should get updated data from the SPS2 Doc Library view
    2. When the form is completed it should be saved with all data so it can be opened later without populating new data into the repeating table

    Here's the problem: how can avoid saved forms from replacing already saved data in the table when they are opened again (and the SPS2 Doc Lib data is changed)? Cathc22??? Is it possible to combine the two scenarios in a simple way in InfoPath?

    Thanks,
    Tom Gullberg
    'Sharepint' all the way...
    Tom Gullberg
    Norway
  • 03-20-2007 03:20 PM In reply to

    Re: Get and save Sharepoint data into form template

    Hi Tom and welcome to our forum!
    You can add a data connection which queries the document library on load if it is the first time opening. To do this without writing code add a boolean node to your main data source called "IsNew". Use that node in the condition for the open rule. To define an open rule, go to Tools->Form Options->Advanced (InfoPath 2003). You can add another rule that copies the values from the SharePoint list/document library into the main data source so that you can show it after the form was opened the second time. You should be able to do this without any code since the doc library view should be "connectable" just like a regular SharePoint list, but I haven't done this recently. Anyway, good luck!
    Patrick Halstead
    Project Manager at Qdabra
  • 03-21-2007 03:29 AM In reply to

    • pluto007
    • Not Ranked
      Male
    • Joined on 03-16-2007
    • Norway
    • Posts 4

    Re: Get and save Sharepoint data into form template

    Hi Patrick - thanks for quick reply!

    Have tried rules on open and it works almost perfect... Problem: the rule that copies values from the table with 2DC to group in Main Source includes only the first row. How can I make the rule go trough every row in the table and copy all rows? The table is a repeating table that can contain x number of rows and I need tp copy all of them. The same will also be necessary when opening the form the second time (copy all rows from the Mian Data source group back to the repeating table in the form (overwrite the data from the 2DC data)).

    Hope this make sense...
    Regards,
    Tom Gullberg
    Tom Gullberg
    Norway
  • 03-21-2007 08:53 AM In reply to

    Re: Get and save Sharepoint data into form template

    Hi Tom,

    Here are some examples of how to do it in the OnLoad event. I don't think there is any way to loop through the rows in rules.

    IXMLDOMNodeList nodes = thisXDocument.DOM.selectNodes("/XPath/To/Nodes");
    foreach (IXMLDOMNode node in nodes)
    {
    //perform operations on node, such as moving to a different DOM
    }

    ///////////////////

    IXMLDOMNodeList nodes = thisXDocument.DOM.selectNodes("/XPath/To/Nodes");
    IXMLDOMNode node;
    while ((node = nodes.nextNode()) != null)
    {
    //perform operations on node, such as moving to a different DOM
    }


    I have always used the second one.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.