I want to hide the social security number on some payroll report by masking all but the last four digits. How do I do this in Report Writer?
*This post is locked for comments
In report writer, double click on the field containing the social security number. This will open the report field options window. Click on the ... beside the format field and create a new format in the format lookup window. Call it something like STR4_Mask_SSN.
Let everything default in the Format Definition Window. In the format String type in ***-**-XXXX and then click Insert. (Make sure you use capital X). Save the format.
This will create a mask that only shows the last 4 digits.
This didn't work. i am using GP2015R2 with Comprehensive Leave Manager. I would have thought that a format of a field would work in a custom form but it didn't now wor for me. It is showing the first 4 in the last 4 position. 123-45-6789 shows as XXX-XX-1234
Hi Brenda,
The format is working as designed. How the format string suggested will work is that it hard-codes the ***-**- and then uses the first four characters of the field value for the capital Xs. What you need is a calculated field. Use the constant to hard-code the ***-**- and then concatenate a string of the rightmost four characters to this field using the RW_RIGHT user-defined Function. Your completed calculated field definition would look something like this:
"***-**-" # FUNCTION_SCRIPT(RW_RIGHT UPR_WORK_Check.Social Security Number 4 )
The RW_RIGHT user-defined function is in the System Core. The # symbol was created by the Concatenate Function. You pass the function two variables. The first is the string field, the second is the number of characters.
Kind regards,
Leslie
Ok I can use the calculated field method but typically when you mask the SSN you only want to show the last 4. Is there a way to make the format method show only the last 4?
Hi,
I do not know of a way to set up a format mask to read from the right. To my knowledge, the will start at the beginning of the field value to fill in the capital Xs in the format string. Version 2015 gives you the ability to automatically mask the entire number, but it doesn't have the option to just show the last four.
I am using the Comprehensive Leave Manager Direct Deposit Form and the GP2015 SSN Mask doesn't seem to work on that. Since the SSN Format in the field noted above does not show on the last 4 then that is not a solution. I referred back to an old KB article that gave instructions on how to mask the SSN with a calculated field and that worked. I must say I don't understand why the Format for the SSN does not work. Doesn't make much sense to show the first 4.
The fact that it doesn't make any sense to show the fist characters is why the format string doesn't work. The format string wasn't designed to do that. It was designed so that the capital X placeholder is filled by the field value from beginning to end. Think about the phone number format (XXX) XXX-XXXX - the hyphens and parenthesis are just hard coded characters. The phone number field characters are substituted for the Xs from the beginning of the field to the end. The only way to get the right-most four characters to print is by using a calculated field. The only 'default' option we have been provided from within the software is to mask out the entire field. Might as well just remove the field if you're going to do that.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.