how can I write a regex syntax to remove the "-" at the end and convert the number to a negative figure?
Currently the Amount Column is a V_String due to the hyphen at the end. I want to remove the hyphen then convert the cell to a double and make it a negative. I have been playing with the regex syntax to remove the hyphen but have had no luck. Thanks!
Solved! Go to Solution.
Can you just use replace function?
Another way - if you just want to remove it at the end, is to use a multi field formula tool with the following expression:
IF EndsWith(ToString([_CurrentField_]),”-“)
THEN ToNumber(LEFT(ToString([_CurrentField_]), LENGTH(ToString([_CurrentField_]))-1))
ELSE ToNumber([_CurrentField_])
ENDIF
Make sure to select the field of interest and turn off the Copy output fields and add function, and change the output type to Double.
Thanks! This worked!
Thank you! This worked ....very slowly learning regex syntax.
Thanks! Will try this out!