IsValidDecimal issue in IIS8.7

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

IsValidDecimal issue in IIS8.7

Post by prasson_ibm »

Hi,
I am trying to check IsValidDecimal functionality in Datasatage 8.7.
I have developed simple job for this.

RowGen------> TSFM-------> Peek

In Transformer i generated Two columns and assigned below value.

Code: Select all

COL1=IsValidDecimal(StringToDecimal("20368.5"))
COL2=IsValidDecimal(StringToDecimal("Prasoon"))
Result i am getting as
COL1=1
COL2=1

But COL2 should be coming as 0.

Is this a bug or i am doing something wrong? :cry:
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The StringToDecimal('blahblah') will return "0", which in turn is a valid decimal.
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Hi,

Ok,then how can we validate if input is varchar and target is decimal.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I'm not at a DS client where I can test this, but might not

Code: Select all

IsValidDecimal("Prasoon")
work?
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Hi,
I already tried this but it does not work.. :cry:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What does "does not work" mean? Keep in mind the fact that all of the "IsValid" functions require a string input, the goal being to see if the string can be successfully converted to the target data type before you actually effect the conversion.

Are you saying that IsValidDecimal("Prasoon") returns TRUE? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Hi Chullet,
I tried to test IsValidDecimal ("prasoon") and it gave output as 1.
Mayurgupta7744
Participant
Posts: 8
Joined: Wed Jul 10, 2013 11:30 pm
Location: Nagpur

Post by Mayurgupta7744 »

Hi,

I have implemented same scenario in our project to validate whether the input value is character or integer/decimal.
For implementing the same we have use the following function in Transfomer Stage:

Syntax: IF (IsValid("Int32",INPUTCOLUMN") THEN 'Y' ELSE 'N')

When in the input value is integer/decimal it returns 'Y' otherwise it returns 'N'.

You use this logic. I am sure it will work!
Let me know if you need any more details regarding the same.

Best Regards,
Mayur
Best Regards,
Mayur
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Hi
Decimal is not a valid integer, then how come you are getting 'Y' for decimals :cry:
If you are in 8.x version then it may be due to datastage Behaving differently in 8.1 or 8.5 .
check below link.



http://www-01.ibm.com/support/docview.w ... wg1JR39651
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Hi,
Can someone help me to above issue. :cry:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

At this point you should be involving your support provider.
-craig

"You can never have too many knives" -- Logan Nine Fingers
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Post by SURA »

You can try If IsValid (Decimal,input) then xxx else yyy. But what you going to do if the value is not decimal.
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Hi,

If the value is not decimal,i need to reject those records.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

SURA's suggestion is valid - what happens if you try the base IsValid() function with the "decimal" option rather than IsValidDecimal(), do you see the same behavior? From what I've read, they are not the same - the latter is not a 'shortcut' to the former.
Last edited by chulett on Mon Sep 02, 2013 7:52 am, edited 1 time in total.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I think you made a mistake in your inital command. The following will correctly determine whether a string is a decimal or not:

Code: Select all

IsValid("decimal [12.3]",InputLinke.TestColumn)
(I had to experiment a bit to get the format in the right place...
Post Reply