I have a string "-65".
In the transformer I want to do a mathematical operation on this string.
So I need to convert this string into number. How do I handle negative sign. Will DS function StringToDecimal work?
How do I accomplish this ?javascript:emoticon(':roll:')
Rolling Eyes
Even though DS will do an implicit conversion from string to number in a transform stage, it is much better to explicitly convert using a function such as StringToDecimal(), which will take care of the sign.
This partially solves my problem...
Actually the data coming in is "- 65" (there is space in between the negative sign and the number)
I tried Trim() but it doesn't work
I tried convert.
The problem is if I have a decimal value, something like "- 65.70"
Convert(" ", "", InLink.TheNumericString) is giving me "-66" as the output but where as StripWhiteSpaces is giving me "-65.70"
Convert() will not round, this is being done elsewhere. What is the defined datatype of the column or stage variable or derivation where you are doing thsi?