Workbook Table Object Members Reference for SuiteScript 2.1
The workbook.Table object features essential members for managing table views in SuiteScript, including columns and dataset handling.
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
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- Set Sublist Field Values in SuiteScript 2.x for Record Management
Set sublist field values in SuiteScript 2.x for effective record management using standard and dynamic modes.
- Setting Field Values in SuiteScript for Effective Record
Learn to set field values in SuiteScript effectively, troubleshooting common errors and understanding data types.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
Advertising
Reach SuiteScript Professionals
Put your product in front of NetSuite experts who work with SuiteScript every day.
Sponsor This Category