SetDisplayMask method: Field class

PeopleTools provides two variations of the SetDisplayMask field class method. Both the variations are described in this topic.

Syntax

First variation of the method:

SetDisplayMask(Mask_Char, Unmasked_Trailing_Chars)

Description

Use the SetDisplayMask method to mask all or some of the data displayed in certain PIA page controls. The method replaces each character of the displayed field text value with the chosen masking character. The method provides the ability to choose the number of trailing characters to remain unmasked. This method affects the same PIA displays that honor Custom Field Formatting. Once the mask is set, it is persisted within the component. If the value is changed, the masking character is re-applied on the next server trip. The method can be called using event mapping and can be used in combination with IsUserInRole(), IsUserInPermissionList(), or IsPIIandSensitiveForUser() functions to control who can or should not see the unmasked information.

Note:

Masking applies to field length; not data length. For example, in a 100 character field, the field would be padded or filled to 100 characters.

Parameters

Parameter Description

Mask_Char

Specifies a single character value used for masking data (only first character is used if more than one character is entered).

Unmasked_Trailing_Chars

Specifies the number of trailing characters to remain unmasked.

Returns

None.

Example

&field = GetField(Field.AE_BIND_VALUE);
&field.SetDisplayMask("*", 4);
&value = &field.FormattedValue;
&mymsg = "Field.AE_BIND_VALUE is " | &value;
MessageBox(0, "SetDisplayMask", 0, 0, &mymsg);

Syntax

Second variation of the method:

SetDisplayMask(Mask_Pattern)

Description

Use the SetDisplayMask method to mask all or some of the data displayed in certain PIA page controls. The method replaces the displayed field text value with a mask pattern that you define. This method affects the same PIA displays that honor Custom Field Formatting. Once the mask is set, it is persisted within the component. If the value is changed, the masking character is re-applied on the next server trip. The method can be called using event mapping and can be used in combination with IsUserInRole(), IsUserInPermissionList(), or IsPIIandSensitiveForUser() functions to control who can or should not see the unmasked information.

Note:

If the data length matches the mask pattern length, the mask pattern will be applied and as a result data will be masked to the data length. However, if the mask pattern length does not match the data length, the field will be fully masked to the field length with the first character of the mask pattern.

Parameters

Parameter Description

Mask_Pattern

Specifies a pattern to mask the actual data.

Consider the following when specifying a masking pattern:

  • The length of the mask pattern should match the data length of the field being masked.

  • Use the @ character to print the actual data in the position where it is used.

    For example, if the field value is New York, and the mask pattern is SetDisplayMask(“****@@@@”), the masked field displays as ****York.

  • Use any other character to print the character instead of the actual data in the position where it is used.

    For example, if the field value is New York, and the mask pattern is SetDisplayMask(“@@p-**hp”), the masked field displays as Nep-**hp.

  • If the length of the mask pattern does not match the length of the data being masked, then the first character of the mask pattern will be used to mask the entire field.

    For example, if the field value is New York, and the mask pattern is SetDisplayMask(“@****@@@@”), the masked field displays as @@@@@@@@.

Returns

None.

Example

&field = GetField(Field.AE_BIND_VALUE);
&field.SetDisplayMask("****@@@@");
&value = &field.FormattedValue;
&mymsg = "Field.AE_BIND_VALUE is " | &value;
MessageBox(0, "SetDisplayMask", 0, 0, &mymsg);