Hi All,
I need to validate a given string in DS server jobs. Check If the given string is decimal or not.For Parallel jobs i can use IsValid(Decimal[m,n],MyString) function in transformer stage, however in Server jobs i am not able to find anything similar to perform that. Can someone help me on that.
for e.g. Column1 - decimal[5,2]
Values to reject - 123.444, 1234.567
Values to pass - 123.45, -123.45
Thanks,
Nitin Gupta
Verify if given string is of Decimal type or not
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 22
- Joined: Fri Jul 26, 2013 9:43 am
- Location: PUNE
Verify if given string is of Decimal type or not
NITIN GUPTA
-
- Participant
- Posts: 22
- Joined: Fri Jul 26, 2013 9:43 am
- Location: PUNE
Whatever you do, don't "test" this using a job but rather the build-in testing capability of the routine editor. Keep it simple so you can rapidly throw many different input strings into it then pass out the status of the conversion as the "answer". And in case you've not used it before, you would use the STATUS function to check the success of the conversion.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Num() function will report whether the value is numeric. That may suffice for your subject requirement. It even handles scientific notation, such as 6.023E23.
It seems, however, that you are interested in answering the question "is this a decimal number with exactly five significant digits and exactly two decimal places?". The Matches operator is our friend here.
It seems, however, that you are interested in answering the question "is this a decimal number with exactly five significant digits and exactly two decimal places?". The Matches operator is our friend here.
Code: Select all
Ans = (inLink.TheString Matches "3N'.'2N")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 22
- Joined: Fri Jul 26, 2013 9:43 am
- Location: PUNE