Hi All,
Is there any function in DataStage which returns the SIGN of a number field. It is also OK if it checks for the sign and returns true or false.
Is there any function which does that?
I have a field with both negative and positive numeric values. I need to capture the SIGN of that number and implement a 'If Then Else' logic.
Please let me know if anyone has used such a function or any other method. Thanks much,
Naveen.
Return SIGN function
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America
-
- Participant
- Posts: 232
- Joined: Sat May 07, 2005 2:49 pm
- Location: USA
Hi NaveenD,
You can convert the numeric field to a string and then use the substring function and check for a "-" sign in the first character of the string. Based on the result, you can apply your processing logic.
Once your processing is done, you can convert the string back to numeric and pass it to the target field.
You can convert the numeric field to a string and then use the substring function and check for a "-" sign in the first character of the string. Based on the result, you can apply your processing logic.
Once your processing is done, you can convert the string back to numeric and pass it to the target field.
Thanks,
Naveen
Naveen
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America
Hi pnchowdary,
I need not do the conversion. I can just use the 'Count' function to check if the count of "-" = 0 or not and then implement my logic.
But I wanted to know whether there is any function which checks for the sign and me being ignorant of that.
But I want to thank you very much for your reply.
Many Thanks,
Naveen.
I need not do the conversion. I can just use the 'Count' function to check if the count of "-" = 0 or not and then implement my logic.
But I wanted to know whether there is any function which checks for the sign and me being ignorant of that.
But I want to thank you very much for your reply.
Many Thanks,
Naveen.
-
- Participant
- Posts: 232
- Joined: Sat May 07, 2005 2:49 pm
- Location: USA
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America
How about IF NUM(In.CheckNumber) THEN IF (In.CheckNumber<0) THEN '-' ELSE '+' ELSE '*'
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: