How to increment

hello
I have column in which their is some ids in this format (XXXX0001).
I wanted to increase the value to xxxx0002 and so on.
please help.

Hi,

Basically assign activity would help us to increment. If it simple integer we are trying to increment. We will do like below.

Yourinteger = yourinteger+1 so automatically it will increment.

For suppose your value datatype as string but those are numbers in string format you can use below expression like

Youtstring = (cint(youtstring)+1).tostring

Or youtstring = (convert.toint32(youtstring)+1).tostring.

In your case we would like to understand wahat is the xxxxx is it a string. If you have combined with string and integer. You have to use regex or string manipulations and divide the integer from string and apply the second method I have mentioned above to increment. Thanks.

thanks for reply
helping one more time how do I separate the string and integer

@lakshya_garg1

Welcome to forums

That you can u do using Regex

Check as below

The above expression will extract the A-Z which is captial, that you can store in a variable

and below for numbers

Hope this will help you

Thanks

actually i am beginner so please tell me another way. I hope you will understand

@lakshya_garg1

Okay, Is there any fixed length that your string follow?

like ABCD0001

Where ABCD is a fixed here

Is it your case?

Thanks

yah there are only four character and they all are fixed. I want to change only integer value

@lakshya_garg1

Then write as below

image

Hope this will help you

Thanks

thanks
let me try

not working

Hi,

Could you share what you are trying with a screenshot for further help. Thanks.


here is the image
here the IQIN if fixed value and i want to increase integer value with that

feel free to shorten the oneliner

new Regex("([A-Z]+)([\d]+)").Replace("XXXX0001",Function (m) m.Groups(1).Value & (Cint(m.Groups(2).Value) + 1).toString.PadLeft(4,"0"c))

thanks for solution
but sorry I don’t know about rejex well I am beginner. so I requested you to tell me some other solution

You can work with the substring approach as mentioned above
the part of incrementing and left padding will be the same
grafik
(Cint(YourVarWithNumberString) + 1).toString.PadLeft(4,"0"c)