Masked text type

Masked type documentation.

Overview

A mask can be specified to enforce a specific pattern for the text stored in this field.

It’s important to note that only the text entered by the user will be stored. This means that if there are characters coming from the mask, they won’t be saved in the database. For example, if the mask is “999-aaa” and the value entered is “123-ABC,” the value stored in the database will be “123ABC.”

Available features

NameSupported
Many multiplicityyes
Default valuesyes
Unique flagyes
Required flagyes
Indexable flagyes
Sensitive flagyes
Calculated valueyes
Automatic initializationno
Calculated initial valueno
Aggregationno
Default type rulesyes
Default display optionsno

Type rules

Mask

Specifies the mask used to validate values. Special characters in the mask include:

  • 9: Must be a number.
  • a: Must be a letter.
  • w: Must be a number or a letter.

You can also include other characters in the mask that will remain fixed. For example, the mask “999-aaa” will accept values like “123-ABC” or “123ABC.” In this case, you can omit the dash because it’s part of the mask.

In the UI, special characters like 9, a, and w will be displayed as empty spaces where you can enter values. Other characters will be displayed as they are and will be read-only.

REST API

Read format

The format is a simple string that is already formatted according to the mask:

"taxId": "862-SKB"

Write format

To set the value, you should provide a string with the appropriate value:

"taxId": "123-ABC"

You can omit fixed characters in the mask:

"taxId": "123ABC"

JavaScript API

Read format

The val() method within the wrapper will return an already formatted string:

// this will print something like "taxId: 123-ABC"
log('taxId: '+record.field('taxId').val());

Write format

You can pass the value with or without the mask format:

// all these lines are equivalent
record.field('taxId').val('123-ABC');
record.field('taxId').val('123ABC');

Export/Import

Export format

The export format is a simple string:

"maskedTextField1","maskedTextField2"
"abc-123","udl-860"

Import format

The import format is a simple string:

"maskedTextField1","maskedTextField2"
"abc-123","udl-860"

Queries

For more information, please refer to the Query Language Documentation.

Available operators

OperatorSupportedNotes
equalsyes
notEqualsyes
emptyyes
notEmptyyes
likeyesIt’s important to note that in this case, the matching will be done with the value stored in the database. This means that fixed characters in the mask won’t be considered for the matching process. For instance, if the mask is “999-aaa” and the value is “123-ABC,” querying with like(3-A) won’t result in a match. However, querying with like(3A) will match.
greateryes
greaterOrEqualsyes
lessyes
lessOrEqualsyes
betweenyes
currentUserFieldno

Query formats

For equality queries, you can provide the value with or without the mask format. For example:

// finds companies with tax ID '123-ABC' 
var records_sample = sys.data.find('companies', {'taxId': '123-ABC'});
log('total: '+records_sample.count());
while (records_sample.hasNext()) {
    log(records_sample.next().label());
}
// finds companies with tax ID '123-ABC' 
var query_sample = sys.data.createQuery('companies')
    .field('taxId').equals('123-ABC')
var records_sample = sys.data.find(query_sample);
log('total: '+records_sample.count());
while (records_sample.hasNext()) {
    log(records_sample.next().label());
}
// finds companies with tax ID '123-ABC' 
GET /data/contacts?taxId=123-ABC

You could skip the fixed characters in the mask as well:

// finds companies with tax ID '123ABC' 
var records_sample2 = sys.data.find('companies', {'taxId': '123ABC'});
log('total: '+records_sample2.count());
while (records_sample2.hasNext()) {
    log(records_sample2.next().label());
}
// finds companies with tax ID '123ABC' 
var query_sample2 = sys.data.createQuery('companies')
    .field('taxId').equals('123ABC')
var records_sample2 = sys.data.find(query_sample2);
log('total: '+records_sample2.count());
while (records_sample2.hasNext()) {
    log(records_sample2.next().label());
}
// finds companies with tax ID '123ABC' 
GET /data/contacts?taxId=123ABC

Keep in mind that you cannot use the formatted form when using the like operator, as the matching will be done with the value stored in the database.

Aggregate queries

Please refer to the Aggregate Queries Documentation for more detailed information.

Available operators

OperatorSupported
sumno
avgno
firstyes
lastyes
minyes
maxyes

UI queries

Please refer to the UI Queries Documentation for more detailed information.

Matching of values

PropertyDescription
Matching operatorlike
Keep in mind that you cannot use the formatted value. See the notes in the like query operator.

Available operators

OperatorSupported
Many valuesyes
Greaterno
Greater or equalsno
Lessyes
Less or equalsyes
Betweenno