Page 1 of 1

Whitespace added after every value

Posted: Fri Nov 06, 2009 4:13 pm
by pandujoy
Hi Gurus,

I have a input field coming all char data types and when i do a lookup against char datatype fields the lookup is failing becoz the values are coming along with spaces.

ex. char (3) input field - "30" when i do a look up for this field the data is getting rejected and the if i see the data in reject file it shows "30 "

I have tried using trim/stripwhitespaces/trimleadingand trailing.

I have the $APT_STRING_PADCHAR to 0x20 .

Not sure what is the problem..all the datatype as char fields....please help me out.... :? :(

Posted: Fri Nov 06, 2009 4:26 pm
by chulett
That's how CHAR fields work, they are always padded to their full length and that typically with spaces (0x20). Is your lookup field a CHAR(3) as well or a different size CHAR?

Posted: Fri Nov 06, 2009 4:45 pm
by pandujoy
thanks for the reply...My lookup is also char(3)

Posted: Fri Nov 06, 2009 4:54 pm
by chulett
Then as long as both sources are space padded, there shouldn't be an issue matching "30 " to "30 ". What do they look like in your lookup source?

Posted: Fri Nov 06, 2009 4:55 pm
by pandujoy
thanks again for the instace answer...

in the lookup they look like "30" and from input i am getting "30 " .

Posted: Fri Nov 06, 2009 5:01 pm
by pandujoy
Chulett,

I have one more requirement ...is to pass a null field to validate a field.

So as mentioned in the previous issue if i passing field1 it is give as "30 " and for the requirement 2 if i pass null value in i/p it is taking as whitespace...not sure whats wrong with it.....

Can you let me know if there is a way to lookup vchar input field to char field in database.

Posted: Fri Nov 06, 2009 5:06 pm
by chulett
Then your lookup either isn't a CHAR(3) or perhaps the padding character was different when created. You might be able to solve this by simply calling your input field a VARCHAR(3) instead.

Posted: Fri Nov 06, 2009 9:30 pm
by ray.wurlod
Check the value of your APT_STRING_PADCHAR environment variable.

Re: Whitespace added after every value

Posted: Sat Nov 07, 2009 8:33 am
by chulett
pandujoy wrote:I have the $APT_STRING_PADCHAR to 0x20 .

Posted: Mon Nov 09, 2009 7:28 am
by pandujoy
plz help me out

Posted: Mon Nov 09, 2009 8:08 am
by ArndW
chulett wrote:...You might be able to solve this by simply calling your input field a VARCHAR(3) instead.

Posted: Mon Nov 09, 2009 12:07 pm
by ray.wurlod
pandujoy wrote:plz help me out
Who, what or where is "plz"?
:?

Posted: Mon Nov 09, 2009 12:17 pm
by ArndW
Here in Germany, "PLZ" is the zip code, or "Postleitzahl".

Posted: Mon Nov 09, 2009 5:00 pm
by pandujoy
dats funny....any ways thanks for your help..mostly ray and ArnldW .....

Posted: Mon Nov 09, 2009 9:52 pm
by chulett
And unmostly that chulett guy .... :P