How to change only the last 3 characters in a Canadian Postal Code
patrick_j
Posts: 13 Bronze 2
Just getting started with Data Masker and would like to work on a Canadian Postal Code field. As a relatively simple way to preserve location distribution I would like to preserve the first 3 characters and randomize the last three. So the PCode A0A 0A0 would result in A0A 4F8. How would I accomplish this?
Tagged:
Comments
To achieve the result you've specified I would personally use the row-internal synchronization rule to target the PostalCode column. You could then use a substring to take the first 3 characters of the field and then add a random 3 characters at the end, the replacement value clause would look something like this:
SUBSTRING(PostalCode,1,3)+ ' ' + DMSPARAM1
Where DMSPARAM1 is Text, Alpha-Numeric (Formatted) with a format string of %W%W%W
Let me know if you have any more questions - always happy to help out!
The format function definitions should be on the rule itself when you set it, so you'll probably want %n%W%n for that format!
Happy Masking! Let me know if I can help with anything else!
Thank you very much!