Save and Submit/New or Old File - InfoPath Dev
in

InfoPath Dev

Save and Submit/New or Old File

Last post 06-08-2005 08:19 AM by jimmyfo. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 06-07-2005 01:24 PM

    Save and Submit/New or Old File

    Hi, I was wondering if it would be possible to use the submit button to save at the same time. Specifically: when a user clicks the submit button, the data is stored in the primary database as well as saved in a SharePoint document library as an InfoPath XML document. That way, the data is stored and can be opened, viewed, changed, and resubmitted via the portal - when an existing form is opened from the portal library, the changes are reflected in both the Document Library file and the SQL database.

    On the same note, how would I make sure that the data that was resubmitted was not saved as a seperate entry, but rather overwrote the old material. I would also like to be able to save the file as the primary key's value. Thank you for you help.

    James
  • 06-07-2005 03:46 PM In reply to

    Re: Save and Submit/New or Old File

    Hi James Fogarty,
    Welcome to the forum!
    Yes it is possible to submit data to two data sources at the same time, you can have a rule which has two actions.
    One action you will submit data to database and in another action you will submit Form to Sharepoint.

    To overwrite an existing file which has same name,
    when you are creating a connection a submit connection to sharepoint there will be checkbox which says "Allow overwrite if file exists", you need to check this check box to overwrite existing file.

    Hope this Helps!

    Agni
    InfoPathDev India
  • 06-08-2005 06:42 AM In reply to

    Re: Save and Submit/New or Old File

    Thanks for the help Agni. I had tried to use the rules and make the file submit to the SharePoint, but I get this error:

    InfoPath cannot submit the form.
    An error occurred while the form was being submitted.
    The form cannot be submitted to the following location:
    http://fth-gtg-3021-0/Application Template/Forms/AllItems.aspx/concat(_TEST - _, name).xml
    The folder does not exist.

    fth-gtg-3021-0 is the portal, Application Template is the Document Library where the InfoPath form is published. The path I used as the data connection ishttp://fth-gtg-3021-0/Application%20Template/

    Also, just usinghttp://fth-gtg-3021-0/ as the address will allow a submit, but the file never appears.

    Thanks for your help.
    James
  • 06-08-2005 08:19 AM In reply to

    Re: Save and Submit/New or Old File

    Hi, the code I'm testing the query with to see if the name exists (so that I can append a number to it) is as follows:


    // Get the default SQL command for the form.
    var strOrigSQLCommand = XDocument.QueryAdapter.Command;

    // Get the query node that you want to check.
    //var queryName = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/@name");

    //Set the value of the datafield.
    var queryName = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:applicantTable/@name");

    // Construct the full query string.
    var strSQLQuery = strOrigSQLCommand;
    strSQLQuery = "select name '" + queryName.text + "' from applicantTable";

    // This is the query.
    XDocument.UI.Alert(strSQLQuery);

    // Run the query.
    XDocument.QueryAdapter.Command = strSQLQuery;
    try
    {
    XDocument.Query();
    XDocument.UI.Alert("No Value for name in database.");
    }
    catch(ex)
    {
    XDocument.UI.Alert("Name in database or invalid return." + ex.number + " " + ex.description);
    }

    // Restore the default table command (for the next time).
    XDocument.QueryAdapter.Command = strOrigSQLCommand;
    }


    The error message I get on runtime is:


    The following error occurred:

    The query method on the Document object failed.
    InfoPath cannot run the specified query.
    The XML data returned from the data source does not match the XML Schema for this form. This discrepancy might be caused by the data source returning multiple rows when InfoPath expects only one.
    Attribute 'James_Fogarty' is not allowed on element 'http://schemas.microsoft.com/office/infopath/2003/ado/dataFields}applicantTable', according to Schema.


    File:script.js
    Line:150



    Any ideas?

    Thanks.

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