Refreshing an existing form when opened via Sharepoint List - InfoPath Dev
in

InfoPath Dev

Refreshing an existing form when opened via Sharepoint List

Last post 03-11-2011 12:01 PM by corybooth. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 03-11-2011 05:03 AM

    Refreshing an existing form when opened via Sharepoint List

    I am using IP2007 and SP2007.

    I have a complicated form that I have managed to get deployed as Browser Enabled via Form Services.

    The backend database is SQL Server using a WebService connection to send and receive data.

    The webserver currently has one "open" method to return data based on the FormID - which is an AutoNumber column in SQL Server.

     

    Perhaps I did this wrong in my WebService, but I have a new form open up with a hidden default value for the FormID as 0.
    When the form is saved to the WebService, the code checks if the incoming FormID is 0, if so, it "Inserts" a new row - if not, it "updates" based on the "none 0" FormID.

    This works fine... Until I have a user want to update an existing form and they open it via SharePoint.

    What I guess is happening is that sharepoint stores whatever was initially submitted - which means all the ID's on the form will be 0 since that is the default value.
    Those values wouldn't actually change until the data hits the database - so a new form wouldn't know what values go there in the first place.

    I have tried some of the following ideas.

    On the Submit button, Save the form to SQL first, Requery, then Save the form to Sharepoint.

    I have tried to employ a rule that when the form is opened, it requery's the WebService connection - but without a proper ID - the form is locked up.

    So the question is....

    When using an autonumber (or any other PK) from SQL Server, how do I get those SQL assigned PK's updated on a from when it is opened from a SharePoint list?

     

    Edit...  What I would like to do is have a Link that opens the form and it uses the WebService to retrieve the data - instead of opening the form XML that was saved to the SharePoint list.
    But how do you do this?  Something like http://mysite.com/_layouts/FormServices.aspx?blahblah....  ?FormID=46 - not sure how this would work.

  • 03-11-2011 06:51 AM In reply to

    Re: Refreshing an existing form when opened via Sharepoint List

    OK so I tried some other approaches...  And now I am curious..

    1.  I tried to do this, send my form back as normal to the WebService.
    2.  Set the opened form's default vaule for the ID = to a Secondary Data Connection return of Max(ID) (understanding if this is ran immediately after the Send to WebService - the chanes of a wrong ID would be very slim)....

    So the though was, user submits which goes to webservice.
    Query runs to get the highest ID which would be the form the user just submitted.
    Form now gets the ID updated to the proper ID.
    Form is saved to SharePoint and can now be linked.

    Problem....

    Trying to set the ID on the Form results in ("Only Integers Allowed") eh?  It is an integer (I even has an IsNull(Max(ID),0) )
    So I decided to set a "TempID" field which was "WholeNumber" = to this returned ID - then set the Form ID = to the TempID.  No Good.
    What's that about?

    Ok, so I filp the script...

    I set all my ID's on SQL to uniquenumber.
    I do a similar function on SQL to return a newid() which is a GUID.

    I now place that return in the GUID formated ID box.
    Won't accept it?  Why not?  Error = "Specific Pattern"  But the pattern in the box is 8-4-4-12 - a true GUID....

    So is there some type of problem setting a PK on a Form?

     

  • 03-11-2011 12:01 PM In reply to

    Re: Refreshing an existing form when opened via Sharepoint List

    OK figured this out....

    1.  I had a webmethod that returned / queried results by ID (the PK for the form)

    So when the Data connection was made, the form had a Required check for both the Data Fields AND the query fields.

    2.  I changed things around.  I gave the form an new ID field - string type.
    I made this field equal to concat "ID - ", now()

    3.  I then made the webservice query by this new ID.

    4. I made the form rule - check ID when opened, if ID <> blank then insert the ID into the query field and then run a query webservice.

     

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