Mask

Mask

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

Mask

The Purpose of Masking Patterns

Masking patterns are used to format data values in a manner appropriate to the type of information they represent.

For example, in Zim, dates are stored as a special type of numerical value, in which the first four digits represent the year, the next two represent the month and the last two stand for the day.

As such, the date June 28, 2014 is stored numerically as 20140628. This allows for mathematical operations to be performed on dates, but this format is not intuitive for presentation.

By using a masking pattern, such as “DD/MM/YYYY”, this date value will now be presented as the string “28/06/2014”, which is instantly recognized as a date.

The same masking pattern is also used to format the input of data into a date entry field. Instead of typing 20140628, the end-user can type 28062014, because the separator character / is only presented between the year, month and day values, but is not actually part of the date value itself.

The same principle can be applied to separator characters in currency values, postal codes, phone numbers, etc.

Situations in Which Masking Patterns Are Used

Zim offers the possibility of applying data masking patterns in different situations, each with a specific set of fixed and masking characters, as summarized in the table below (follow the links in the first columns for more information):

MaskingDefinined asPurposeRemarks
Data MaskEntry field property
(DataMask)
Input
Display
  • Defines the expected format of the data value while it is being typed
  • Displayed as the mask pattern before any data is entered into an entry field
  • Formats the display of a data values after it is typed into an entry field
Field MaskField property
(FieldMask)
Zim Reports
list
output
  • Defines the expected format of the field’s data value when it is printed or listed in Zim Reports,
    or by the list or output commands
MASKFormat option i n
Zim Reports
Zim Reports
  • Defines the expected format of the field’s data value when it is printed or listed in Zim Reports
  • When used, overrides the FieldMask property of all fields
$maskFunctionlist
output
  • Defines the expected format of a field or a data value when printed or listed by the list or output commands
  • When applied to a field, overrides its FieldMask property

Masking Characters According to Data Types

The set of available masking characters is different according to the Data Type property (DT) of the entity set field or the entry field.

The following sections describe the available masking characters for each data type:

Alphanumeric Masking

Alphanumeric masking is used to format generic text data. It is particularly useful when data is entered in shortened form but displayed in full form.

In the output value, each question mark is replaced by one character from the current value of the report item, in order from left to right.

When no more characters remain in the value, any remaining question marks become spaces.

Alphanumeric Masking Characters

Masking CharacterPurposeDataMaskFieldMaskMASK$mask
?Placeholder for any alphanumeric character✔✔✔✔
\?the question mark character ?✔✔
Displayed as is✔✔✔✔

Examples

 

Field Mask      MASK      $mask

Leading or trailing spaces are indicated by / in the Output column.

Mask PatternField ValuePrinted, Listed or Reported Data Value
‘?epartment ??’D04Department 04
‘SIN no.: ???-???-???’987654321SIN no.: 987-654-321
‘Part No \?xyz???\?466Part No ?xyz466?
‘???’ABCDABC
‘????’ABCABC/

Data Mask

Mask Pattern PresentedTyped DataStored Entry Field ValueDisplayed Data
???ABCABC
(???) ???-????2123459786(212) 345-9786
?epartment ??D01Department 01
?epartment ??D01 abcDepartment 01 abc

Note:

If the CM (compress status) attribute of a form field is N, the value of the form field is the same as the displayed data. Otherwise, the value of the form field is the same as the input data vlue.

lf the mask pattern is shorter than the field length, then the mask is assumed to contain ? characters in the missing positions (See the last example above).

Non-Digit Masking

Non-digit mask patterns are nearly identical to alphanumeric ones, with the exception that digits (0, 1, …, 9) are not accepted as valid input.

Date Masking

Date masks are composed of three types of character groups, representing the year, month and day, which can be combined in any order.

Between each group there may be an optional fixed separator character, such as /, , ., or blank space, which appear in the display or output as is.

For date entry fields, the default masking pattern is MM/DD/YY.

Date Masking Characters

Masking CharacterPurposeDataMaskFieldMaskMASK$mask
DDPlaceholder for the day (2 digits)✔✔✔✔
MMPlaceholder for the month (2 digits)✔✔✔✔
YYPlaceholder for the year (2 digits)✔✔✔✔
YYYYPlaceholder for the year (4 digits)✔✔✔✔
Represents a fixed separator character, usually /, , ., or blank space✔✔✔✔

Examples

 

Field Mask      MASK      $mask

Leading or trailing spaces are indicated by / in the Output column.

Mask PatternEntity Set Field ValuePrinted, Listed or Reported Data Value
DD/MM/YY1999081818/08/99
YYYY-MM-DD199908181999-08-18
MM DD YYYY1999081808 18 1999

Data Mask

Mask Pattern PresentedTyped DataStored Entry Field ValueDisplayed Data
MM/DD/YYYY052314921492052305/23/1492
YYYY-MM-DD14920523149205231492-05-23
YY/MM/DD9105231991052391/05/23
DD-MM-YY2305911991052323-05-91
MM/DD/YY0523911991052305/23/91

Numeric Masking

 

When the data item contains decimals, the decimal point in the mask pattern is aligned with the decimal point in the value, and digit substitutions are made from right to left for the mask characters to the left of the decimal point, and from left to right for the mask characters to the right of the decimal point.

A series of 9s can therefore be used to force the printing of non-significant zeros to the right of the decimal point (in dollar values, for example). A 9 would also be used to force the printing of leading zeros in serial numbers: for example, 009876.

Any report item whose current value is too large to fit in the specified mask pattern (including the sign output, if applicable) causes the overflow characters (asterisks) to be displayed.

  • the currency placeholder ($) and sign placeholders: plus (+), minus (), left and right parentheses (( and )), and the special character strings CR and DB

The currency placeholder inserts the applicable currency symbol into the output value.

Sign placeholders reflect the sign of the number (positive or negative) in the output value. The left parenthesis can be used only on the left-hand side of the mask pattern. The CR, DB and left and right parenthesis can be used only on the right-hand side of the mask pattern. The plus and minus signs can be used on either side of the mask pattern.

The plus and minus signs, left parenthesis, and the dollar sign can be used as float characters. A single plus, minus, dollar sign, or left parenthesis can also “float” ahead of a series of other floating characters.

  • fixed text characters

Typically, in the output value, fixed text characters (e.g., commas) appear as is, provided that there are digits remaining to be substituted into the mask or that the mask character 9 forces the output of zeros.

Numeric Masking Characters

Masking CharacterPurposeDataMaskFieldMaskMASK$mask
9Replaced by a digit when matched in the input or 0 when unmatched✔✔✔✔
ZReplaced by a digit when matched in the input or a blank space when unmatched✔✔✔✔
*Replaced by a digit when matched in the input or * when unmatched✔✔✔✔
$Replaced by the currency symbol as defined in zimlang.zim✔✔✔✔
.Placeholder for the decimal point as defined in zimlang.zim✔✔✔✔
,Placeholder for the comma as defined in zimlang.zim✔✔✔✔
+Placeholder for the + (plus) sign✔✔✔✔
Placeholder for the – (minus) sign✔✔✔✔
CRPlaceholder for the CR (credit) symbol, as defined in zimlang.zim✔✔✔✔
DBPlaceholder for the DB (debit) symbol, as defined in zimlang.zim✔✔✔✔
(Represents ( to the left of negative values, instead of the negative sign “✔✔✔
)Represents ) to the right of negative values, instead of the negative sign “✔✔✔
Displayed as is✔✔✔✔

Examples

 

Field Mask      MASK      $mask

Leading or trailing spaces are indicated by / in the Output column.

Mask PatternEntity Set Field ValuePrinted, Listed or Reported Data Value
‘9,999,999’78506067,850,606
‘9,999,999’785060,078,506
‘*,***,***’78506067,850,606
‘*,***,***’78506***78,506
‘Z,ZZZ,ZZZ’78506067,850,606
‘Z,ZZZ,ZZZ’78506///78,506

Data Mask

Mask Pattern PresentedTyped DataStored Entry Field ValueDisplayed Data
99991231230123
999.912312.3012.3
ZZZZ123123123
ZZZ.Z12312.312.3
ZZZ,ZZZ.ZZ-123456-1234.56-1,234.56
$$$,$$$.$$ CR-123456-1234.56$1,234.56 CR
Was this article helpful?
5 out of 5 stars

1 rating

5 Stars 100%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_CAEnglish