Reputation: 49
I am creating a report by Crystal Reports which will mask address field depending upon parameter set to the report. I know this can be done using formula. I can successfully mask with hard coded value. However I need something like password masking. For example, if address is D/302 ABC apartment
, it should be displayed as X/XXX XXX XXXXXXXXX
. Only characters and numbers to be masked space and special characters not be masked. In addition length of masked data should match actual data.
Upvotes: 0
Views: 271
Reputation: 49
Logic is correct.. I have done the same thing by using Mid function instead of chrW (). Additional you can use formula as ReplicateString ("X",len(address)); Only problem is space will be also masked
Upvotes: 0
Reputation: 49
Logic is correct.. I have done the same thing by using Mid function instead of chrW (). No need to use asw () either. Simply use range operator.
Upvotes: 0
Reputation: 16958
I think you can use a formula like this:
Local StringVar str := "";
Local NumberVar strLen := Length({User.Address});
Local NumberVar i;
For i := 1 To strLen Do
(
if (ChrW({User.Address}[i]) in (AscW("A") to AscW("Z"))) or (ChrW({User.Address}[i]) in (AscW("a") to AscW("z"))) or (ChrW({User.Address}[i]) in (AscW("0") to AscW("9"))) Then
str := str + "X"
else
str := str + {User.Address}[i];
);
str
Upvotes: 1