cancel
Showing results for 
Search instead for 
Did you mean: 

Masking SSN within Doc Comp to Only Display Last 4

Tiffany_McKinni
Champ on-the-rise
Champ on-the-rise

I am attempting to create a custom mask to only show the last 4 of the ssn.  Assuming the ssn is 123-45-6789, I create the mask to show like this: xxx-xx-____, but instead of getting xxx-xx-6789 I get xxx-xx-1234 (the first 4 of the ssn.)  Is there a way to do what I am attempting?

3 REPLIES 3

Randy_Rasmusse1
Champ in-the-making
Champ in-the-making

I would be interested in other answers.  For my use case, I was using Doc Comp from Workview and I created a calculated attribute that created the mask I was after instead of attempting to mask from within Doc Comp.

Grant_Fitzgeral
Star Contributor
Star Contributor

Hi Tiffany,

I just tested this and it should work, assuming all of your SSNs are formatted the same in the table they're in and the last 4 characters are always numeric (our SSN keyword is set up as alphanumeric to allow for dashes, but after review, that's not the only thing that exists in there).

Set up a new placeholder (External Data Source) on your Doc Comp template and use the SQL below (or some variant of it that fits your solution).

SELECT 'XXX-XX-' + RIGHT(RTRIM(ssn2.keyvaluechar),4)
FROM hsi.keyxitemXXX ssn1
INNER JOIN hsi.keytableXXX ssn2 ON ssn2.keywordnum = ssn1.keywordnum
WHERE ssn1.itemnum = XXXXXXX
GROUP BY ssn2.keyvaluechar

Hope this helps,

Grant

Dave_Feit1
Confirmed Champ
Confirmed Champ

If this solution uses Workflow, you could utilize an expression to trim the SSN to the last four digits, and place the result in a keyword or hidden Unity Form field.  

Then you could create a placeholder for that value preceded by static text for the XXX-XX- portion.