Reading and Writing a Single Value each time an InfoPath Form is Opened and Saved. - InfoPath Dev
in

InfoPath Dev

Reading and Writing a Single Value each time an InfoPath Form is Opened and Saved.

Last post 12-13-2010 08:22 AM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 12-09-2010 10:45 AM

    Reading and Writing a Single Value each time an InfoPath Form is Opened and Saved.

    I need to write a single value each time an InfoPath form is saved to a location. The next time the InfoPath form is launched, the form must be able to retrieve this value and place it in a textbox. The form is for purchase orders, and the value is the number of the last purchase order. The first time the form is opened and saved, one would be written. The second time the form is opened the value 1 would be read in and the value 2 would be saved when the form is saved.

    I do not want to write this value to a SharePoint List where a new record will be created each time the form is saved.

    I want to write a single value to the SharePoint Server (not store an array of values) and have the ability to read this value when opening a new form. What is the easiest way to do this? Can I create an xml form which is rewritten each time? How do I go about establishing a data connection to read this discrete value. Can I lock the form from being checked out after it was opened to prevent duplicate values? If so how?

    Thank you.

  • 12-13-2010 08:22 AM In reply to

    Re: Reading and Writing a Single Value each time an InfoPath Form is Opened and Saved.

    Hi BissetTBD,

    Typically, we just set the value in the form before saving using a globally unique identifier or a derived key. Neither works for normal PO#s though since the values are not what your customer's expect for an ID. I would use a key that is created using date and time in the following format: YYYYMMDDNNN where NN is a unique PO number for that day. To get that unique number, you will need to lock an XML file that you keep on the server. You can define a data connection for that XML doc. The XML doc just keeps a number. Hilary wrote a nice blog last week about how to check-out and check-in. To do this without code is quite possible since the NNN XML is a very small snipped. You can just use concat to create the XML and then submit the string to SharePoint - I believe this can be done without code, but maybe not. At any rate, the free trial of qRules can be used to do it.

    Good luck with your challenge!

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.