Boolean type

Boolean type documentation.

Overview

This data type can store a boolean value. Fields of this type cannot be null; their value is strictly either false or true.

Available features

NameSupported
Many multiplicityyes
Default valuesyes
Unique flagno
Required flagno
Indexable flagyes
Sensitive flagyes
Calculated valueyes
Automatic initializationyes
Calculated initial valueyes
Aggregationno
Default type rulesno
Default display optionsyes

Display Options

Representation

This determines how the field should appear. The available options are:

  • Switcher: In edit mode, a switch will be shown, and in read-only mode, a box with the label will be displayed. When this option is selected, you can specify the labels to be either “Yes/No” or “On/Off”.
  • Check Box: In edit mode, a check box will be displayed, while in read-only mode, a check mark or a cross will appear based on the value.

REST API

Read format

The format is a boolean value:

"isCustomer": false

Write format

You should provide a boolean:

"isCustomer": true

JavaScript API

Read format

When using the val() method in the wrapper will return a boolean value:

// this will print something like "customer: true"
log('customer: '+record.field('isCustomer').val());

Write format

You should provide a boolean to set the value:

record.field('isCustomer').val(true);

If you pass null, it will be coerced to false.

Export/Import

Export format

The export format is a string where the value could be either "true" or "false":

"booleanField1","booleanField2"
"true","false"

Import format

The import format supports various representations for true and false:

  • True values: "true," "1," "yes" (case-insensitive)
  • False values: **"false," "0," "no" (case-insensitive)
"booleanField1","booleanField2"
"true","false"
"1","0"
"yes","no"

Queries

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

Available operators

OperatorSupported
equalsyes
notEqualsyes
emptyno
notEmptyno
likeno
greaterno
greaterOrEqualsno
lessno
lessOrEqualsno
betweenno
currentUserFieldno

Query formats

You should provide the boolean value. For instance:

// finds a task with rank 'iiiii00000' 
var records_sample = sys.data.find('companies', {'isCustomer': true});
log('total: '+records_sample.count());
while (records_sample.hasNext()) {
    log(records_sample.next().label());
}
// finds a task with rank 'iiiii00000' 
var query_sample = sys.data.createQuery('companies')
    .field('isCustomer').equals(true)
var records_sample = sys.data.find(query_sample);
log('total: '+records_sample.count());
while (records_sample.hasNext()) {
    log(records_sample.next().label());
}
// finds a task with rank 'iiiii00000' 
GET /data/contacts?name=true

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 operatorequals
Strings "true," "yes," and "1" are interpreted as the value true, while strings "false," "no," and "0" are understood as false.

Available operators

OperatorSupported
Many valuesyes
Greaterno
Greater or equalsno
Lessno
Less or equalsno
Betweenno