Published on April 3, 2024.
Starting with NetSuite 2024.1, you can easily export the SuiteQL query that defines a SuiteAnalytics dataset. This can be very helpful if you're trying to develop queries that are similar to datasets, and you want to see how that dataset is constructed.
To do so, select Analytics and select the Datasets tab. Then select the dataset that you want to work with. When the dataset is displayed, click the Export button, and select "Export dataset to SuiteQL TXT" from the export options. This will initiate the download of a text file that contains the query.
It's interesting to see what the SuiteQL queries for datasets look like. They're not always pretty, and certainly not what I was expecting. For example, here's the query behind the standard "Transaction Detail" dataset.
SELECT BUILTIN_RESULT.TYPE_INTEGER("TRANSACTION"."ID") AS "ID" /*{id#RAW}*/, BUILTIN_RESULT.TYPE_STRING("TRANSACTION".tranDisplayName) AS tranDisplayName /*{tranDisplayName#RAW}*/, BUILTIN_RESULT.TYPE_DATE("TRANSACTION".tranDate) AS tranDate /*{tranDate#RAW}*/, BUILTIN_RESULT.TYPE_STRING("TRANSACTION"."TYPE") AS "TYPE" /*{type#RAW}*/, BUILTIN_RESULT.TYPE_INTEGER(transactionLine.entity) AS transactionLinesentity /*{transactionLines.entity#RAW}*/, BUILTIN_RESULT.TYPE_STRING(transactionLine.memo) AS transactionLinesmemo /*{transactionLines.memo#RAW}*/, BUILTIN_RESULT.TYPE_CURRENCY(transactionLine.foreignAmount, BUILTIN.CURRENCY(transactionLine.foreignAmount)) AS transactionLinesforeignAmount /*{transactionLines.foreignAmount#RAW}*/, BUILTIN_RESULT.TYPE_INTEGER(TransactionAccountingLine."ACCOUNT") AS accountingImpactaccount /*{transactionLines.accountingImpact.account#RAW}*/, BUILTIN_RESULT.TYPE_CURRENCY(TransactionAccountingLine.amount, BUILTIN.CURRENCY(TransactionAccountingLine.amount)) AS accountingImpactamount /*{transactionLines.accountingImpact.amount#RAW}*/ FROM "TRANSACTION", "ACCOUNT", TransactionAccountingLine, transactionLine WHERE (((TransactionAccountingLine."ACCOUNT" = "ACCOUNT"."ID"(+) AND (transactionLine."TRANSACTION" = TransactionAccountingLine."TRANSACTION" AND transactionLine."ID" = TransactionAccountingLine.transactionline)) AND "TRANSACTION"."ID" = transactionLine."TRANSACTION")) AND (("TRANSACTION".tranDate >= BUILTIN.RELATIVE_RANGES('SOTM', 'END', 'DATETIME_AS_DATE') AND TransactionAccountingLine.amount IS NOT NULL AND NOT( UPPER("ACCOUNT".acctType) IS NULL OR UPPER("ACCOUNT".acctType) IN ('NONPOSTING') )))
Regardless, it's a nice feature, and a welcomed enhancement to SuiteAnalytics.
For more information on the feature, see NetSuite Export Dataset Definitions to SuiteQL from Workbook.
Also, it's worth noting that there's a little known feature of the SuiteQL Query Tool that supports directly loading the query for a SuiteAnalytics workbook's dataset. To enable it, update the suitelet, and on line 82, set the value of workbooksEnabled to true. When you load the tool, you'll see a new "Workbooks" button, which provides a function for selecting a workbook.
Hello, I'm Tim Dietrich. I develop custom software for businesses that are running on NetSuite, including mobile apps, Web portals, Web APIs, and more.
I'm the developer of several popular NetSuite open source solutions, including the SuiteQL Query Tool, SuiteAPI, and more.
I founded SuiteStep, a NetSuite development studio, to provide custom software and AI solutions - and continue pushing the boundaries of what's possible on the NetSuite platform.
Copyright © 2025 Tim Dietrich.