Home > Zim Language Reference > Language Reference - alphabetical > $mask
$mask
Applies a mask pattern to the specified data item.
For a more detailed explanation of mask patterns and their relation to data types, see Masking.
Syntax
$mask(item,pattern)
Parameters
item |
- A value of any type or an expression that yields a value of any type; or
- An field of any data type.
|
pattern |
- The mask pattern to apply to item.
- alphanumeric;
- a constant, a variable, a parameter, or a field.
|
Return Value
Character string, containing the masked value.
Comments
- Mask patterns consist of special characters and fixed text characters;
- Fixed text characters are always output as is;
- The set of special characters available for use to mask a particular data value is determined by the data type of value being masked (character string, date, or number );
- Most special characters are typically replaced by characters from item, but they can also output characters in their own right (e.g., the floating currency symbol: $, which can be customized);
- The Language Customizer utility (ZIMLANG) can be used to redefine how certain special characters are displayed or output.
For example, in numeric masks, the currency symbol $ normally outputs a dollar sign, but it can be configured to output other symbols, such as the pound sign £ or yen sign ¥.
Examples
list all Employees format FirstName LastName \
($mask(DeptNum,"?epartment Number ??"))
Displays values of DeptNum, such as "D09", as "Department Number 09", instead of "D09".
list all Employees format FirstName LastName \
($mask(Salary,"$$$$$$9.99"))
Displays all values of Salary with a floating dollar sign.
$mask ($date, "MM-DD-YY")
Evaluates to "08-18-98" if $Date is 19980818.