Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
philmywallet
Contributor

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
Highlighted
MVP & Luminary
MVP & Luminary

Re: Name field encrypt part

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


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Re: Name field encrypt part

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


talk is cheap, supply exceeds demand

View solution in original post

philmywallet
Contributor

Re: Name field encrypt part

Perfect.

Thanks

Phil

philmywallet
Contributor

Re: Name field encrypt part

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

E.g.  J*****n

jsaradhi
Valued Contributor

Re: Name field encrypt part

modify Gysbert's expression to do it:

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

bestofwest
Contributor II

Re: Name field encrypt part

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

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