cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
jacquenv
Nintex Newbie

RegEx- Adding leading zeros in workflow to generate request number

Jump to solution

I have workflow that was previously using a formatted column to grab the next available request number.  Now they seem to unsupported.  I get the number from a column I call NextNumber, add leading zeros, and tack it at the end of a string I put together from 2 other columns, so it looks like TravelRequest-FY19-0001.

 

I tried using some RegEx I found on this forum (not much) and internet but I get weird results or it only gives me the number with no zeros.  I want a max of 4 numbers (0001 to 9999)

 

This is one I tried, but it only gives me the number without 0.

(\d+)/'0' x (4-length($1))

 

I also assume using a RegEx (replace?) to build the leading zeros first then a build string would be the easiest?

Labels: (1)
Tags (3)
0 Kudos
Reply
1 Reply
jacquenv
Nintex Newbie

Re: RegEx- Adding leading zeros in workflow to generate request number

Jump to solution

This proved to be more hassle than it was worth.  I was trying to improve on a logic the previous builder of this workflow had done and get around the suddenly unsupported nature of using calculated columns.

 

I decided to get my fiscal year from this list as I had redesigned (rather than using calendar year) but not to generate an ID from here.  Previously it would take the number stored in NextNumber and add 1 for the next workflow but many times in the past it would not be a unique number due to how frequently people submitted new requests. 

 

So to solve my unique ID problem and this weird issue of trying to keep with the same logic, I used the actual ID of the item instead of this generated one.  To solve any sorting weirdness I also sort descending by request number (to capture FY first) then sort descending by ID.

 

View solution in original post

0 Kudos
Reply