dataset.createCondition(options)
Method Description |
Creates a dataset condition (criteria). A condition is applied to a dataset column and includes an operator. For more information about criteria used in datasets in SuiteAnalytics, see Dataset Criteria Filters. |
Returns |
|
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Sibling Module Members |
|
Since |
2020.2 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
|
optional |
The child conditions. Conditions can be grouped. A group of conditions is represented as a single Condition object that combines the child conditions in the group using the AND operator. This Condition object can then be used as one of the children of a higher-level condition. Use this parameter when the |
|
|
required, unless |
The column to apply the condition to. For the top-level condition in a dataset (the single condition that child conditions are combined into), this property is always null. Child conditions are implicitly combined using the appropriate operator (AND, OR) to produce a single condition, so no column needs to be specified. |
|
|
string |
required |
The operator for the condition. For the top-level condition in a dataset (the single condition that child conditions are combined into), this property is always either AND or OR. The top-level condition can only combine child conditions using these operators, not more advanced ones (like NOT or ANY_OF). You can use values from query.Operator. You can also use ‘AND’ or ‘OR’ when the |
|
Array< |
optional |
The values for the condition. For the top-level condition in a dataset (the single condition that child conditions are combined into), this property is always an empty array. Child conditions are implicitly combined using the appropriate operator (AND, OR) to produce a single condition, so no values need to be specified. |
Errors
Error Code |
Thrown If |
---|---|
|
The |
|
Both the |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/dataset Module Script Samples. Also see the Tutorial: Creating a Dataset Using the Workbook API topic.
// Add additional code
...
// Create a Condition without values
var myCondition = dataset.createCondition({
column: myNameColumn,
operator: query.Operator.EMPTY
});
// Create a Condition with values
var myCondition = dataset.createCondition({
column: myNameColumn,
operator: query.Operator.EQUAL,
values: ['Smith']
});
// Create a Condition with children
var myCondition = dataset.createCondition({
operator: query.Operator.IS,
children: myChildCondition // Create this with a separate call to dataset.createCondition
});
...
// Add additional code