Final pivot creation
Finally, we use workbook.createPivot(options) to create the pivot, and we use workbook.create(options) to create the entire workbook, including the table view and pivot.
var pivot = nWorkbook.createPivot({
id: 'pivot',
name: 'Pivot: Transaction types per posting period',
dataset: dataset,
rowAxis: rowAxis,
columnAxis: columnAxis,
reportStyles: [reportStyle]
})
context.workbook = nWorkbook.create({
tables: [tableview],
pivots: [pivot]
})
At this point, your workbook script file is complete and should look similar to the full script in the Workbook section of Full scripts.
You're done! Now you can use the Dataset Builder Plug-in and Workbook Builder Plug-in to upload your script files to NetSuite, and you can view the complete dataset and workbook in the Analytics area.
Previous: Create a table view