Metabase Version: v0.47.6
I have a column containing names where I would like to show the first 2 characters, the last characters and replace those in between with a '*'.
Example:
Robert = Ro**rt
Christopher = Ch*******er
Writing in SQL query mode I can achieve this using:
CONCAT(LEFT(name, 2), REPEAT('*', LENGTH(name) -4), RIGHT(name, 2)) AS name
LEFT and RIGHT within a Question can be replaced with a variant of Substring i.e.
=CONCAT(SUBSTRING([Name], 1 , 2), SUBSTRING([Name], LENGTH([Name] -1, 2))
Resulting in:
Robert = Rort
Christopher = Cher
My issue is trying to replicate the REPEAT function to add a variable length of '*'. I could add a fixed string of ellipses however ideally I'm looking for a variable length equivalent.
I have a large selection of questions in which I now need to obfuscate the full value, so ideally I'd like to keep them as Questions opposed to converting to SQL.
Any thoughts on enabling this, or perhaps I'm looking at the problem completely the wrong way.
Cheers,
Rob.