01-15-2025 07:21 AM - edited 01-15-2025 08:17 AM
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"
Solved! Go to Solution.
01-15-2025 08:38 AM
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}
01-15-2025 07:27 AM - edited 01-15-2025 07:31 AM
.
01-15-2025 07:45 AM
Hi @jpworkato ,
Workato does not support the "succ" formula for generating successors. To achieve this functionality, you can use Ruby, Python, or JavaScript to manipulate the data. If you need further details or assistance, feel free to reach out!
Thanks and Regards,
Shivakumara K
01-15-2025 07:51 AM
Thank you for your reply.
I am kind of new to workato and still figuring things out. Can you help me to get this done either by Ruby or JavaScript.
01-15-2025 08:38 AM
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}