cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

is Ruby function succ is available to use on workato and how?

jpworkato
Not applicable
succ โ†’ new_str

Returns the successor to str. The successor is calculated by incrementing characters starting from the rightmost alphanumeric (or the rightmost character if there are no alphanumerics) in the string. Incrementing a digit always results in another digit, and incrementing a letter results in another letter of the same case. Incrementing nonalphanumerics uses the underlying character setโ€™s collating sequence.

"abcd".succ        #=> "abce"
"THX1138".succ     #=> "THX1139"
"<<koala>>".succ   #=> "<<koalb>>"
"1999zzz".succ     #=> "2000aaa"
"ZZZ9999".succ     #=> "AAAA0000"
"***".succ         #=> "**+"

Error: I would like to get next number from "SO012501" to "SO012502"

image.png

1 ACCEPTED SOLUTION

gary1
Executive Chef III
Executive Chef III

The succ method isn't supported in the in-line Ruby (in formulas and variables), but it is supported in the Ruby action.

Create a Ruby action with an input called "str" and and output called "result" and then use this code snippet:

 

{result: input["str"].succ}

 

View solution in original post

5 REPLIES 5

image.pngThank you for the information, that works!