cancel
Showing results for 
Search instead for 
Did you mean: 

I've a scenario where I want to generate a sequential number and facing a challenge as mentioned below.

I have a scenario where I want to generate a sequential number and facing a challenge as mentioned below.

I have a 10 digit number with preceding zeroes for e.g. 0000000001 and I want to increment it by 1 so my result should be 0000000002 and so and so on. It's quite simple to increment number with calc stage but with blue prism, it removes the leading zero by default when I increment. Since leading zero to number is useless when doing ToNumber and increment blue prism gives output as "2" but I want output as "0000000002".

This is quite obvious behavior but how can I achieve this use case using blue prism?

------------------------------
Thanks & Regards,
Tejaskumar Darji
Sr. RPA Consultant-Automation Developer
------------------------------
3 REPLIES 3

JerinJose
Level 10
Hi TejasKumar,
if you can accept the result as a text then use the below VB code

Decimal add = input + 1;
result = add.ToString("000000000");


20646.png

------------------------------
Jerin Jose
RPA Product SME
EY
Asia/Kolkata
*"If you find this post helpful mark it as best answer, .*
------------------------------

Thanks for the answer. But my string length would change if my input is 0000000009 and the next increment would make it 10 and then code adds leading 9 zeroes resulting string be 11 lengths instead of 10.

------------------------------
Thanks & Regards,
Tejaskumar Darji
Sr. RPA Consultant-Automation Developer
------------------------------

Try using the PadLeft action in Utility - Strings. You can specify how long you want the string to be as well as the character you want to pad the string with.

------------------------------
Patrick Aucoin
Product Manager
Blue Prism
------------------------------