Workbook Table Object Members Reference for SuiteScript
The workbook.Table object provides essential members for manipulating table views in SuiteScript, including columns and datasets.
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 Name | Return Type / Value Type | Supported Script Types | Description |
|---|---|---|---|
Table.columns | workbook.TableColumn[] | Server scripts | The columns in the table view. |
Table.dataset | dataset.Dataset | Server scripts | The dataset for the table view. |
Table.id | string | Server scripts | The ID of the table view. |
Table.name | `string | workbook.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
1// Code to create a workbook.Table object2var myTable = nWorkbook.createTable({3 columns: [column1, column2], // Previously defined workbook.TableColumn objects4 dataset: myDataset, // Previously defined dataset5 id: 'myTableId', // Unique identifier for the table6 name: 'myTableName' // Label for the table7});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
1// Load the workbook and log the first column of the first table2var myWorkbook = workbook.load({3 id: myWorkbookId 4});5 6log.audit({7 title: 'Table.columns = ',8 details: myWorkbook.tables[0].columns[0] // Accessing the first column9});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.
Key Takeaways
- The
workbook.Tableobject provides key features for managing table views. - Members like
columns,dataset,id, andnameare 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?
What are the necessary attributes to define when creating a workbook.Table object?
Can I use workbook.Table in client scripts?
How do I access the columns in a workbook.Table object for logging or inspection?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
