You can translate the question and the replies:

Data Masking: Replace NULL

Hi , If we mark a field as sensitive, user can view the value as NULL. Can we replace the field value from NULL to a set of characters. For e.g: Id=98201 (Unmasked) Id=9 * * * 1 (Masked) Thanks
user
25-11-2021 09:48:54 -0500
code

1 Answer

Hi, If you need to replace the value of a field you need to create a new field in a derived view. An example of the code giving you the result in your question would be as follows (xxxx is the viewname.fieldname you want to replace) CONCAT(SUBSTRING(xxxx,0,1),' * ', SUBSTRING(xxxx FROM LEN(RTRIM(xxxx)) FOR 1)) This assumes the field is text and has trailing spaces and is variable length. Remember you can also use functions like GETSESSION so the replacement only occurs for certain conditions. ie only apply this mask to user 'Dave'. CASE WHEN (getsession('user') = 'Dave') THEN (CONCAT(SUBSTRING(xxxx,0,1),' * ', SUBSTRING(xxxx FROM LEN(RTRIM(xxxx)) FOR 1))) ELSE xxxx END Hope this helps.
Denodo Team
26-11-2021 05:38:05 -0500
code
You must sign in to add an answer. If you do not have an account, you can register here