Here is the Engineer’s solution:

 

SET VAR vOld TEXT = '12345C'

 

SET VAR vNew = ((SGET(.vOld , ((SLEN(.vOld)) - 1) , 1 )) + 
(CHAR((ICHAR((SGET(.vOld, 1, SLEN(.vOld))))) + 1)))

 

That should increment the last alphanumeric character regardless of the text 
variable length.

 

If you want to just increment the last alphanumeric character and keep the same 
variable name, you can use:

 

SET VAR vOld = ((SGET(.vOld , ((SLEN(.vOld)) - 1) , 1 )) + 
(CHAR((ICHAR((SGET(.vOld, 1, SLEN(.vOld))))) + 1)))

 

This is as simple as it gets.

 

Javier,

 

Javier Valencia, PE

 <mailto:[email protected]> [email protected]

O: 913-829-0888

C: 913-915-3137

 

 

 

From: [email protected] <[email protected]> On Behalf Of Dan 
Goldberg
Sent: Monday, May 17, 2021 2:23 PM
To: [email protected]
Subject: [RBASE-L] - Increment letters

 

I have a number with a letter suffix. 

 

12345C

 

I need to increment it to the next letter. So it would be:

 

12345D

 

Has anyone done this before? I am drawing a blank…

 

TIA

 

Dan Goldberg

 

 

 

-- 
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected] 
<mailto:[email protected]> .
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/2E4830CEC16615458329D3D83342F8D0014E8C2298%40EXCHANGE10
 
<https://groups.google.com/d/msgid/rbase-l/2E4830CEC16615458329D3D83342F8D0014E8C2298%40EXCHANGE10?utm_medium=email&utm_source=footer>
 .

-- 
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/!%26!AAAAAAAAAAAYAAAAAAAAABa4qWuusAlBoskXxE2AV1mChgAAEAAAAKh6TOdvSoRDlib6RC%2Bo7akBAAAAAA%3D%3D%40vtgonline.com.

Reply via email to