Integer Validation issue

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

Post Reply
vskr72
Premium Member
Premium Member
Posts: 128
Joined: Wed Apr 28, 2004 9:36 pm

Integer Validation issue

Post by vskr72 »

I have a column (loast column) coming from a flat file (fixed width). I am doing an integer validation for it using the below statement:

Code: Select all

If IsValid("int32", Col) then 'Valid' else 'invalid'
The values in the source file are between 0 to 5. I was expecting the output to be 'Valid'. But surprisingly its 'Invalid'. Not sure if I am doing anything wrong.
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Are you sure that , the column contains a single digit only? i believe there's some non printable characters after that.
try:

Code: Select all

If IsValid("int32", trim(Col)) then 'Valid' else 'invalid' 
pandeeswaran
premupdate
Participant
Posts: 47
Joined: Thu Oct 04, 2007 3:37 am
Location: chennai

Post by premupdate »

The output of IsValid function is either 1 or 0.Change the derivation accordingly.
Cheers,
prem
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

premupdate wrote:The output of IsValid function is either 1 or 0.Change the derivation accordingly.
Not necessary to change!
As you said it returns true or false.
If true then valid else invalid.
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So, what was the actual resolution? Posting that information helps future searchers...
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply