If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

First 5 digits Zipcode with 0 in front

Started by peewan, 27 Feb 2020 09:15:41 AM

Previous topic - Next topic

peewan

the [Zip] original data type: varchar (10), value 820010121, 085492561...

I would like to get first 5 digits of zip code only.

My data item:  trim(substring(cast([zip], varchar(10)), 1, 5))

Zip code with value:
820010121 return '82001' - WORKED
085492561 return '85492' - NOT WORKED - missing '0' at front. How would I fix this?

Thank you

adam_mc

If its already a varchar(10) data item you should not need to trim - substring([Zip], 1, 5) should work.

Hope this helps.
Adam.

peewan

Sorry for this, but i just check original data in Toad,  the zipcode with 0 in the front show up '23562639', so it is missing '0' from the raw data if it have 0 in front - and showed up as 8 digits only.

How could i fix it in cognos.
Thank you

peewan

#3
Hello,

i got this from another topic. Thanks a lot.

From <https://www.cognoise.com/index.php?topic=32504.0>