Workbook Table Object Members Reference for SuiteScript

The workbook.Table object provides essential members for manipulating table views in SuiteScript, including columns and datasets.

·2 min read·View Oracle Docs

The workbook.Table object is essential for developers working with table views in SuiteScript. It provides key members that help to define and manipulate the structure of tables within your applications. Understanding how to utilize these members effectively can enhance the way data is represented in your NetSuite environment.

What Are the Members of the Table Object?

The workbook.Table object includes several members that allow you to access and modify properties of the table view. Here's a detailed breakdown:

Member NameReturn Type / Value TypeSupported Script TypesDescription
Table.columnsworkbook.TableColumn[]Server scriptsThe columns in the table view.
Table.datasetdataset.DatasetServer scriptsThe dataset for the table view.
Table.idstringServer scriptsThe ID of the table view.
Table.name`stringworkbook.Expression`Server scripts

How to Create a Table Object

To create a workbook.Table object, use the workbook.createTable(options) method. Here is a basic example of how to instantiate a table object:

Code Sample

suitescript
1// Code to create a workbook.Table object
2var myTable = nWorkbook.createTable({
3 columns: [column1, column2], // Previously defined workbook.TableColumn objects
4 dataset: myDataset, // Previously defined dataset
5 id: 'myTableId', // Unique identifier for the table
6 name: 'myTableName' // Label for the table
7});

This snippet demonstrates how to declare and initialize a workbook.Table object, which can then be used in various operations throughout your script.

Logging Table Columns

If you need to log or inspect the columns of a table, you can do so with the following syntax:

Code Sample

suitescript
1// Load the workbook and log the first column of the first table
2var myWorkbook = workbook.load({
3 id: myWorkbookId
4});
5
6log.audit({
7 title: 'Table.columns = ',
8 details: myWorkbook.tables[0].columns[0] // Accessing the first column
9});

This approach is useful for debugging and understanding the structure of your table data.

Conclusion

The workbook.Table object and its members are powerful tools in SuiteScript, enabling developers to craft dynamic and effective data views in NetSuite. Mastering these attributes will improve your ability to control how data is presented to users.

Source: This article is based on Oracle's official NetSuite documentation.

Key Takeaways

  • The workbook.Table object provides key features for managing table views.
  • Members like columns, dataset, id, and name are essential for defining tables.
  • Understanding syntax and usage can enhance data representation in your scripts.

Frequently Asked Questions (4)

How can I create a workbook.Table object in SuiteScript?
To create a workbook.Table object, use the workbook.createTable(options) method with appropriate options for columns, dataset, id, and name.
What are the necessary attributes to define when creating a workbook.Table object?
When creating a workbook.Table object, you need to define the columns as an array of TableColumn objects, the dataset for the table, a unique id, and a name for the table.
Can I use workbook.Table in client scripts?
No, the members of the workbook.Table object are supported in server scripts only.
How do I access the columns in a workbook.Table object for logging or inspection?
You can access the columns by first loading the workbook, then referencing the tables array and the specific column, such as myWorkbook.tables[0].columns[0].
Source: Table Object Members Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Integration

View all Integration articles →