Unique number for Form

M

Marc Dimmick

I have created a webform using Infopath 2007. I would like each form as it is
created to have a unique identifier in the file name. Can anyone indicate the
format for this file name that needs to be setup in the Submit Option -
Filename
 
K

K.Ramana Reddy(GGK Tech)

Hi,

Are you using code or rules to submit the form to share point?
If you use code, you can use any field in your form as fine name and Concate
Guid to that field .
Guid generates the uniquenumber for every time new form is opened.
To generate guid use System.NewGuid().
 
A

Anna Wójcik

To get something unique you can use time function - get the exact time
of form submition. You can use string function to truncate time format.
Another unique identifier is ID of list item, if you submit to form
library, but you have this after it is added.

K.Ramana Reddy(GGK Tech) pisze:
 
G

gurufoo

I can't take credit for this solution, but I can't find the site where I
found the solution again either...I'll post the basic steps for you here
though. Though I tried to use the timestamp in my filename originally, I
found that every time I submitted the form, it created a new version (because
of the timestamp in the filename). If you aren't submitting your form or
only saving it then the timestamp should be fine.

1) Create a Data Connection that Recieves data from the SharePoint list
you're submitting to. You might call it <YOUR_LIST_NAME>_IDs . The only
field you need to select is the ID field.
2) In your form, create a field (I used a text box) that has a Default Value
of 'max(@ID) + 1' where @ID is the ID field from <YOUR_LIST_NAME>_IDs .
3) In your Submit Data Connection make the filename include the ID from the
field you created in step 2.

There is a resource out there that gives more detail, but this should set
you in the right direction.
 
G

gurufoo

I'm not sure I understand. The only "extra" processing involved is an
aggregate function (count) and a simple mathmatical computation (+1). I'm
hard pressed to believe that those two processes would hamper performace even
if there were hundreds of thousands of records.

If you meant something else, please explain as I must have misunderstood.

-James
 
A

Anna Wójcik

I mean data retrieved from the server from the data source. I noticed
that if I use 'heavy' data source - list with e.g 500 items, form is
loading much longer.

gurufoo pisze:
 
G

gurufoo

I wish I had a definitive answer for you. Still, I'd be very suprised if
using the count() function was causing the form to load more slowly.

Earlier this morning I found another method of ensuring unique filenames
that doesn't rely on counting the number items in the list. There are
probably improvements to this method I came up with, but this solution is
working for me:

1) Create a text box (hidden if you like) called daFileName
2) In InfoPath 2007 go to Tools -> Form Options -> Open and Save -> Rules
and add a rule. The rule Condition should be "if daFileName is blank" and
the action should set the value of daFileName to concat(userName(), now())
This should create a "for sure unique" filename because the same user can't
create two forms at the same instant...unless they're a ninja 8^)

-James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top