COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: nfldbunker on 13 Dec 2011 08:03:30 PM

Title: masking partof data element
Post by: nfldbunker on 13 Dec 2011 08:03:30 PM
hi

i have a report which has a code and name in one column. i want to show the code but hide the nameportionof this data element. what is the best way to hide this

regards

bunker
Title: Re: masking partof data element
Post by: HalfBloodPrince on 14 Dec 2011 02:10:26 AM
Can you show some example of records in that data items .
Title: Re: masking partof data element
Post by: nfldbunker on 14 Dec 2011 06:33:12 AM
column 1   column 2    column 3
0124john  location      condition
4256bill
9788fred

should be

0124
4256
9788
Title: Re: masking partof data element
Post by: MFGF on 14 Dec 2011 08:27:44 AM
Do you always want the first four characters of the item? If so, add a query calculation with the following expression

substring([Your Item],1,4)

Cheers!

MF.
Title: Re: masking partof data element
Post by: HalfBloodPrince on 14 Dec 2011 09:35:29 AM
Am completely  agree with MF, for substring([column],1,4). Just for a change you can try this function of DB2

left ([name],4)  for achieving the same.

Thanks
Title: Re: masking partof data element
Post by: blom0344 on 15 Dec 2011 01:15:04 AM
Quote from: HalfBloodPrince on 14 Dec 2011 09:35:29 AM
Am completely  agree with MF, for substring([column],1,4). Just for a change you can try this function of DB2

left ([name],4)  for achieving the same.

Thanks

That should only work with native functions enabled in the package and working against a DB2 database.
substring basically exists for all major RDBMS which makes is a more logical choice..