0
votes

I have been working on a project for a while and I'm stuck.

I have a form used to add new data to the list. In that form, I have created a number generator that changes based on the criteria a user has selected from several filtered lists.

For example, if I were to ask where Jack lives, the first field would ask what continent he lives on, then the next field filters countries on that continent, followed by time zones, states, and finally cities.

The drop downs would look something like this in the end: North America -> The United States of America -> Mountain Standard Time -> Colorado -> Denver. The number generator concatenates values into a string based on Jack's selection. So North America would populate the generator with a 2, the United States would give 7, and so on until I have a generated number of 27032. I need this number to be completely unique. So in the event that Jill (who also lives in Denver) fills out the form, the generated number will be different from Jacks.

Jack - North America -> The United States of America -> Mountain Standard Time -> Colorado -> Denver - Auto Generated number: 27032

Jill - North America -> The United States of America -> Mountain Standard Time -> Colorado -> Denver - Auto Generated number: 27032 but it auto increments to 27033 since 27032 is already taken.

I understand that the ID field already holds a unique value, but most of the time, the number generator won't populate sequential numbers (this is on purpose and based on the criteria provided). I simply need the generated number to increment if it is already found in the Sharepoint list, and to continue to check (and increment) until the generated number is finally unique, then finally save the incremented number in the list.

The tools I have to make this happen are Sharepoint 2010, Sharepoint Workflows, and Infopath 2010. Any help that you guys can provide would be incredibly helpful.

Thank you,

John

1

1 Answers

0
votes

There are two ways to deal with this

  1. Use of default ID column along with combination your are generating i.e. 27032

127032 [1:ID 27032:Combo] store it in calcated column or update text column on item adding event of WF

  1. If you dont want ID column then Create list called Counter list and keep only one record to maintain sequential counter for example : 000001

Once you add record in your list, on item adding event Workflow will trigger and will read current counter value i.e. 000001 and will read combination value 27032 and will store combined string in list column as an unique ID [27032000001]. next you will update counter to 000002.

Only drawback is once unique ID is generated, user cant modify values entered in form.