Solved

Incremental item number starting from 1000

  • 18 September 2018
  • 6 replies
  • 153 views

Badge +10

Hopefully this should be fairly straight forward. I need a field to be a unique number for each new item added to a list. I need it to start from 1000. I've set up two variables:
number_variable
number_variable_plus_one

I've set the number variable default to 1000. Then I've got a Math Operation with Plus Value 1 and store result in
number_variable_plus_one.

All that it's returning is 1001 with every new item. I know I'm missing something obvious?

 

Any help appreciated.

icon

Best answer by shrinivasnaik 18 September 2018, 16:28

View original

6 replies

Badge +8

Hi Darren,

number_variable is initialised always with 1000 so obviously the number will always be 1001? Would you want to reinitialize the number_variable to the last items number?

Generally as a thumb rule whenever I need a unique number I always use SharePoint's identity column as that is always unique (no matter if there is concurrent users trying to create etc)

Initialize number_variable to Identity Column of your ListItem.

Variables

Offset - 1000

number_variable - Initialise with "ID" column of List Item

 

Math operation - Offset + number_variable --> should give you your unique number starting from 1000

hth.

regards,

Shrini

Badge +10

Thanks Shrinivas Naik‌. Right so I think I don't think I've got this right. I have a:
Set variable action - Set number_variable - Field - ID - When ID Equals Workflow data number_variable - so setting number_variable to the ID number?
Math Operation - Workflow Date Offset (I've set up a variable called Offset) Plus number_variable Store result in number_variable_plus_one
Update Item - Select fields to update - Incremental Number - Workflow Data number_variable_plus_one

What am I doing wrong?

Badge +8

Hi Darren,

I think you have got the pattern right, may be I didnt understand your statement "o setting number_variable to the ID number? "

Will describe in a little bit more detail..

1) Create 2 variables 

      i) Initial Offset - Integer - Default value = 1000

     ii) Number_variable_plus_1000 - Integer

You don't require plus 1 as we can depend on the identity column to give you unique number.

2) Add the Math function

3) Update the list item

Where ReferenceID could be your column on the listitem.

regards,

Shrini

Badge +10

Great, thanks that worked

Badge +8

No worries .. glad could help.

Regards,

Shrini

Badge +11

Hello @shrinivasnaik 


 


How would it be possible if the InitialOffset would be 000000 (6 zeros) and increment by 1. Obviously if I create an interger with 000000 and add + 1 then it is = 1 instead of 000001


 


Hould would this be possible?

Reply