COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Framework Manager => Topic started by: rajua99 on 31 Jan 2011 02:41:37 PM

Title: Hiding SSN Number
Post by: rajua99 on 31 Jan 2011 02:41:37 PM
Hi,

Is there a way to hide the SSN number in the report and just show them last 4 digits only.
SSN number should be in this format XXX-XX-1234

Thanks for all the help in proving solutions to resolve this issue for me.

Thanks,
Raju
Title: Re: Hiding SSN Number
Post by: cognostechie on 02 Feb 2011 12:22:02 AM
You can use the substring function for this. The syntax will depend on what is the field type in the database table.

Ex: If the field is character with a format/mask of xxx-xx-xxxx then

'xxx-xx-' + substring(SSN,6.4)

There is another post in this forum for security on SSN Nos. Check that one too. 
Title: Re: Hiding SSN Number
Post by: rajua99 on 02 Feb 2011 02:06:17 PM

The field type is the numeric. I want to display both fields one with SSN number and another one with last 4 digits only.

I tired your solution but it is giving me error message when i test the sample.

Title: Re: Hiding SSN Number
Post by: Lynn on 02 Feb 2011 03:01:29 PM
You can't perform a string function on a numeric value. Try casting it to a string first. There are few different ways to do this depending on your DBMS. I believe something similar to below should work.


'xxx-xx-' + substring(cast([SSN],VARCHAR(9)),6.4)
Title: Re: Hiding SSN Number
Post by: cognostechie on 02 Feb 2011 03:59:55 PM
rajua99 - There will be a comma between 6 and 4. I made a typo to make your life difficult !  ;)
Title: Re: Hiding SSN Number
Post by: rajua99 on 02 Feb 2011 04:59:59 PM
Quote from: Lynn on 02 Feb 2011 03:01:29 PM
You can't perform a string function on a numeric value. Try casting it to a string first. There are few different ways to do this depending on your DBMS. I believe something similar to below should work.


'xxx-xx-' + substring(cast([SSN],VARCHAR(9)),6.4)


This solution worked for me. Thanks a lot to Lynn and Cognostechie.