Hello, I am trying to print search results to a pd...
# suitescript
j
Hello, I am trying to print search results to a pdf, and using the code from netsuite documentation, but it does not seem to work, var renderer = render.create(); renderer.templateContent = xmlStr; renderer.addSearchResults({ templateName: 'result', searchResult: results }); - it seems that i am missing something here, can someone post a code snippet here on what should be templateName and the xmlstring that should be used
b
use the template you created as the template for the renderer (preferably using TemplateRenderer.setTemplateByScriptId)
the templates you create in the ui should use
results
as the template name for the search results, so that is what you should use for your templateName in script
j
thanks battk, seems there was an issue with template in sample code and also the settemplatebyscriptid fetched some errors, finally copied the template string and ran it, and it worked finally. many thanks @battk
also @battk we are limited to sending one result slice of max 1000 results to add to addsearchresult in renderere, any idea how to add full search result (more than 4000+ lines)
b
im sure there is some limit, but 1000 is not it
if you are making the mistake of only using getRange once before using addSearchResults, then you should get all your search results first and then use addSearchResults
that said, you should probably be using runPaged instead of run
j
thanks @battk i am able to get all results into pdf now, but am stuck as its a summarized search and it does not pick the values, for normal search it works, but for summarized / grouped it does not. any idea on how to includ summarized in addsearchresults
b
probably will have better luck using addCustomDataSource
i have never gotten summarized columns to work with the renderer
j
@battk that confirms my finding, strange that renderer does not support such basic need, making it half baked library