Unable to transform string to number with Flow Designer

Rafaeloneil
Giga Contributor

Hello People,

 

I'm building a flow designer (Rome Version) where I have a value as a string (007426) and I need to convert it to a number (7426)

or at least remove the leading zeros in order to compare the result with another value

I'm trying to use the resource below (https://docs.servicenow.com/bundle/sandiego-servicenow-platform/page/administer/flow-designer/refere...)

find_real_file.png

but the option doesn't appear for me in the functions step

find_real_file.png

 

Do I need to do something different or is it a version issue? In this case how could I be able to perform this operation in the rome version?

1 ACCEPTED SOLUTION

VaranAwesomenow
Mega Sage

I figured it out

You need to use math function -> Absolute value, it converts 0012345 to 12345

find_real_file.png

find_real_file.png

 

find_real_file.png

 

View solution in original post

3 REPLIES 3

VaranAwesomenow
Mega Sage

007426 is also a number ? not sure if string to number would truly work in this case. it can do something like below

Example

  • Input: “500”
  • Output: 500

solution : have you tried fx where you can write a function 

s = s.replace(/^0+/, '');

reference : https://stackoverflow.com/questions/8276451/remove-truncate-leading-zeros-by-javascript-jquery

VaranAwesomenow
Mega Sage

I figured it out

You need to use math function -> Absolute value, it converts 0012345 to 12345

find_real_file.png

find_real_file.png

 

find_real_file.png

 

Rafaeloneil
Giga Contributor
It worked wonderfully, Thank you Anil!