Thursday, March 22, 2007 8:13 PM
I have multiple users completing forms and submitting them to a single SharePoint library. I need a simple way to automatically assign a random or sequential four-digit number to a particular field: "Job_Number". This would preferably be done when the form opens. Then I could configure the "submit" buttom to refer to this job number. Any suggestions? Thanks.
Friday, March 23, 2007 12:53 AM
There is a flaw in using random numbers.
A random number will not prevent two (or more) forms getting the same number. Random is not the answer for you if you want to guarantee uniqueness.
To get unique "job numbers" you will have to setup a database (SQL as a favorite) that will store a number, and a stored procedure that will get the request for the nubmer, increase it and return it as a transaction - make sure no two requests get the same number. Infopath will then trigger that SP every time a form is open.
This may cause some "jumps" in the numbering - when someojne opens a form and closes it without submitting, but seeing as how you were ok with random numbers I guess the sequence is not really important, as long as the newest forms have a higher number so you can sort by job number.
Friday, March 23, 2007 1:17 PM
Hello Ishai and thanks for the quick response. The randomly assigned number would only be a temporary number. Eventually the "process" assigns a job number but I just need a unique number to get it started.
Any thoughts on a random number? Thanks.