Hi All,
I am trying to convert this (475,971.29) string by replacing the '(' ')' and making it as a positive number using the formula component, but not getting proper output with correct decimal places.
IF
StartsWith([Outstanding], '(') AND EndsWith([Outstanding], ')')
THEN
ToNumber('-'+REGEX_REPLACE([Outstanding],'[[:punct:]]|[\$\+<=>\^`\|~]',''), '0')
ELSE
ToNumber([Outstanding],'0')
ENDIF
Input: (475,971.29)
Expected output: -475971.29
Solved! Go to Solution.
I think your RegEx is replacing the decimal point? You don't need RegEx for this anyway, a simple formula will do it.
ToNumber(Replace(Replace([Outstanding], '(','-'), ')',''))
Don't need to use regex.
With basics formula functions, you can easily do that. Find the solution attached.
Let me know if it works as you want and do not hesitate to mark this answer as solution if it helped.