dataset.create(options)

Note:

The content in this help topic applies to SuiteScript 2.x.

Method Description

Creates a dataset based on a record type. A dataset can include columns and conditions (criteria).

Returns

dataset.Dataset

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/dataset Module

Sibling Module Members

N/dataset Module Members

Since

2020.2

Parameters

Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

options.columns

dataset.Column[]

optional

The fields (columns) in the dataset.

options.condition

dataset.Condition

optional

The condition (criteria to be applied to the dataset. A condition can have children which are combined using the appropriate operator (AND or OR) to produce the criteria used.

options.description

string

optional

The description of the dataset.

options.id

string

optional

The script ID of the dataset.

options.name

string

optional

The name of the dataset.

options.type

string

required

The internal ID for the record type on which to build the dataset.

Use the Records Catalog to find the Internal ID of scriptable records.

Errors

Error Code

Thrown If

INVALID_SEARCH_TYPE

The options.type parameter is invalid.

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/dataset Module Script Samples.

            / Add additional code
...
// Create a basic Dataset
var myDataset = dataset.create({
    type: 'transaction'
});

// Create a comprehensive (full) Dataset
var myDataset = dataset.create({
    type: 'transaction',
    name: 'My Transaction Dataset',
    id: 'trans_dataset',
    description: 'My comprehensive transaction dataset that includes columns and a condition',
    condition: myCondition,    // Create this using dataset.createCondition
    columns: myColumns         // Create this using dataset.createColumn
});
...
// Add additional code 

          

Related Topics

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

General Notices