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

Zip Code

Started by srinu_anu2007, 04 Sep 2012 03:22:11 AM

Previous topic - Next topic

srinu_anu2007

I have ZIP code column which is retriving as from data base but as per my requirement i wanna to display below like this.

iam having the 5 digit codes:
45612
45678,
12345,
789456123 like this

but i want to display, if eqal to 5 or more than 5 like below
78945-6123
iam using the below code but iam not getting
substring (ZIp),6,1) ='-'

can any one suggest?

MFGF

Hi,

What data type is your Zip code item? I assume it's some sort of numeric field. If so, you should probably code your query calculation as follows:

if (character_length(cast([Your zip code item],varchar(15))) > 5) then (substring(cast([Your zip code item],varchar(15)),1,5) + '-' + substring(cast([Your zip code item],varchar(15)),6,5)) else (cast([Your zip code item],varchar(15)))

Cheers!

MF.
Meep!

srinu_anu2007

Thanks! i got it using the below code.

case when length ([ZIP Column]) >5
then substr ([ZIP Column],1,5) || '-' ||
substr ([ZIP Column],6)
else [ZIP Column]
end