query.Operator

Note:

The content in this help topic pertains to SuiteScript 2.0.

Note:

JavaScript does not include an enumeration type. The SuiteScript 2.0 documentation uses the term enumeration (or enum) to describe a plain JavaScript object with a flat, map-like structure. In this object, each key points to a read-only string value.

Enum Description

Holds the string values for operators supported in SuiteScript Analytic APIs.

SuiteScript Analytic APIs help you work with analytical data in NetSuite using SuiteScript. For more information, see SuiteScript 2.x Analytic APIs.

This enum is used to specify the operator argument to Query.createCondition(options) and Component.createCondition(options). This enum is also used to specify the operator argument to methods in the N/dataset and N/workbook modules, such as dataset.createCondition(options) and workbook.createTableColumnFilter(options). For more information, see Workbook API.

Values for this enum are listed in the Values section. The following columns provide information about each operator:

  • Value — Use these values to specify operators in most queries (for example, query.Operator.BEFORE). To use these values, you must include the N/query module in your script.

  • Mapped String Value — Use these values as strings that represent the corresponding operators (for example, 'BEFORE'). To use these values, you do not need to include the N/query module in your script.

  • Use For — Use this column to determine the value types that each operator supports. For example, the query.Operator.AFTER operator is designed to be used with date/time values, and you cannot use this operator with string or boolean values. Some operators are similar but are designed to be used with different value types (such as query.Operator.IS for boolean values and query.Operator.EQUAL for numeric values).

For multi-select fields, you can use the query.Operator.INCLUDE_* and query.Operator.EXCLUDE_* values to specify a set of exact field values. For example, to obtain script deployment records that apply to all execution contexts except the WEBAPP and WEBSTORE contexts, you can use the query.Operator.EXCLUDE_ALL operator. You cannot use the query.Operator.ANY_OF_NOT operator to obtain these records, because this operator uses an implicit OR operator between all specified values. The query.Operator.EXCLUDE_ALL operator uses an implicit AND operator between all specified values, which lets you create more complex conditions.

Module

N/query Module

Sibling Module Members

N/query Module Members

Since

2018.1

Values

Value

Mapped String Value

Use For

AFTER

AFTER

Date/time values

AFTER_NOT

AFTER_NOT

Date/time values

ANY_OF

ANY_OF

Single-select fields

Multi-select fields

ANY_OF_NOT

ANY_OF_NOT

Single-select fields

Multi-select fields

BEFORE

BEFORE

Date/time values

BEFORE_NOT

BEFORE_NOT

Date/time values

BETWEEN

BETWEEN

Date/time values

BETWEEN_NOT

BETWEEN_NOT

Date/time values

CONTAIN

CONTAIN

Strings

CONTAIN_NOT

CONTAIN_NOT

Strings

EMPTY

EMPTY

Single-select fields

Multi-select fields

EMPTY_NOT

EMPTY_NOT

Single-select fields

Multi-select fields

ENDWITH

ENDWITH

Strings

ENDWITH_NOT

ENDWITH_NOT

Strings

EQUAL

EQUAL

Numbers

EQUAL_NOT

EQUAL_NOT

Numbers

EXCLUDE_ALL

MN_EXCLUDE

Multi-select fields

EXCLUDE_ANY

MN_EXCLUDE_ALL

Multi-select fields

EXCLUDE_EXACTLY

MN_EXCLUDE_EXACTLY

Multi-select fields

GREATER

GREATER

Numbers

GREATER_NOT

GREATER_NOT

Numbers

GREATER_OR_EQUAL

GREATER_OR_EQUAL

Numbers

GREATER_OR_EQUAL_NOT

GREATER_OR_EQUAL_NOT

Numbers

INCLUDE_ALL

MN_INCLUDE_ALL

Multi-select fields

INCLUDE_ANY

MN_INCLUDE

Multi-select fields

INCLUDE_EXACTLY

MN_INCLUDE_EXACTLY

Multi-select fields

IS

IS

Boolean values

IS_NOT

IS_NOT

Boolean values

LESS

LESS

Numbers

LESS_NOT

LESS_NOT

Numbers

LESS_OR_EQUAL

LESS_OR_EQUAL

Numbers

LESS_OR_EQUAL_NOT

LESS_OR_EQUAL_NOT

Numbers

ON

ON

Date/time values

ON_NOT

ON_NOT

Date/time values

ON_OR_AFTER

ON_OR_AFTER

Date/time values

ON_OR_AFTER_NOT

ON_OR_AFTER_NOT

Date/time values

ON_OR_BEFORE

ON_OR_BEFORE

Date/time values

ON_OR_BEFORE_NOT

ON_OR_BEFORE_NOT

Date/time values

START_WITH

START_WITH

Strings

START_WITH_NOT

START_WITH_NOT

Strings

WITHIN

WITHIN

Date/time values

WITHIN_NOT

WITHIN_NOT

Date/time values

Syntax

Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/query Module Script Samples.

            // Add additional code
...
var myCustomerQuery = query.create({ type: query.Type.CUSTOMER
}); var mySalesRepJoin = myCustomerQuery.autoJoin({ fieldId: 'salesrep'
}); var firstCondition = myCustomerQuery.createCondition({ fieldId: 'id', operator: query.Operator.EQUAL, values: 107
});
var secondCondition = myCustomerQuery.createCondition({ fieldId: 'id', operator: query.Operator.EQUAL, values: 2647
});
var thirdCondition = mySalesRepJoin.createCondition({ fieldId: 'email', operator: query.Operator.START_WITH_NOT, values: 'foo'
}); myCustomerQuery.condition = myCustomerQuery.and( thirdCondition, myCustomerQuery.not( myCustomerQuery.or(firstCondition, secondCondition) )
); var resultSet = myCustomerQuery.run();
...
// Add additional code 

          

Related Topics

N/query Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices