Modules

filter

 

Objects/Functions

module (N/render)

SuiteScript 2.0

TemplateRenderer.addQuery(options)

{TemplateRenderer}.addQuery({id: {string},pageIndex: {number},pageSize: {number},templateName: {string*},query: {query.Query object}})

N/render Module
TemplateRenderer.addQuery()
Method Description: Adds a SuiteAnalytics Workbook query to use as the renderer’s data source. You can specify the query in two ways: As a query.Query object (which you create using the N/query Module) using the options.query parameter. By providing the workbook ID of an existing SuiteAnalytics workbook using the options.id paramter. One of options.query or options.id is required. This method returns a maximum of 5000 results in the query result set. If a query matches more than 5000 results, you must use options.pageIndex and options.pageSize to retrieve the full set of results. There is no governance for this method. When the renderer is executed, rendering consumes 10 units for every iteration through the results. If the query is specified using a workbook ID, rendering consumes an additional 5 units before the first iteration through the results.
Returns: Void
Supported Script Types: Server-side scripts For more information, see SuiteScript 2.0 Script Types.
Governance: None
Module: N/render Module
Parent Object: render.TemplateRenderer
Sibling Object Mambers: TemplateRenderer Object Members
Since: 2019.2
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=TemplateRenderer.addQuery(options)

Example:

// Code Example 1
//Add additional code
//...
var search = query.create({
type: query.Type.TRANSACTION
});
var transactionlines = search.join({
fieldId: "transactionlines"
});
search.condition = transactionlines.createCondition({
fieldId: "netamount",
operator: query.Operator.GREATER,
values: 1
});
search.columns = [
transactionlines.createColumn({
fieldId: "netamount",
label: "Amount"
}),
];

// get instance of TemplateRenderer - https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4412065265.html
var renderer = render.create();
renderer.templateContent = "<#list page as line>${line['0@label']}:${line[0]}\n"

renderer.addQuery({
templateName: "page",
query: search,
pageSize: 3, // minimum page size is 5, so result will contain 5 lines instead of 3
pageIndex: 0,
})
//...
// Add additional code

//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_156217838581.html