You need to make sure, to extract the number value, increment it and then re-attach it.
It is easyer if it is always the same structure like UN-01 but it is more safe to catch all contingencies.
So you could grab the last two digits, but what if you reach 100?
The more secure way is to look for the “-” and grab everything bevore as string and behind as number. then count the number up and re-combine it with the “-”
Then the only condition is, you have to always have only numbers aftzer the first and only “-”…
I’m not sure but maybe I can set up an example later.
The result will be like:
The Expressions in more readable:
right(@Table Aggregation.Latest_ID , (
len(@Table Aggregation.Latest_ID ) // length of the ID-String
- find('-', @Table Aggregation.Latest_ID )) // - number of characters befor "-"
- 1) // - 1 (the "-" itself) --> amount of digits from right to "-"
+ 1 // increment by one
left(@Table Aggregation.Latest_ID ,
find('-', @Table Aggregation.Latest_ID )) // - number of characters before "-"
+1 // +1 for "-" itself
@Variable.counter < 10, '0' + @Variable.counter // add 0 if < 10 and make it a string
, '' + @Variable.counter ) // if >= 10 make it a string with no leading 0