Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Name field encrypt part


I have a name field and I want i to keep the same number of chacters but replace everything with '*' except for the first character.

e.g.

Name = 'Smith'  - Encrypted Name = 'S***'

Name = 'Johnson' - Encrypted name = J******

Is there any script that will do this?

Thanks

Phil

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Left(Name,1) & repeat('*', len(Name)-1) as Name


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Left(Name,1) & repeat('*', len(Name)-1) as Name


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Perfect.

Thanks

Phil

Anonymous
Not applicable
Author

As a further q is there any way I can put the last character on there aswell

E.g.  J*****n

Anonymous
Not applicable
Author

modify Gysbert's expression to do it:

Left(Name,1) & repeat('*', len(Name)-2) & right(Name,1) as Name

Anonymous
Not applicable
Author

It's better define a maximum size: (in this case 60)

Left(Name,1) & repeat('*', 58) & right(Name,1) as Name