This topic contains 3 replies, has 0 voices, and was last updated by marcelp 9 years, 3 months ago.

  • Author
    Posts
  • #2132

    JohnCCole

    Does anyone know if it’s possible to pass search results to the Advanced PDF template in SuiteScript where the search results contain grouped or summed columns? I have tried accessing the columns that are grouped or summed by field name and column index and nothing prints. All non grouped, summed columns in a search result printout fine in the Advanced PDF.
    This is a cached copy. Click here to see the original post.

  • #2133

    marcelp

    I have also been looking for this answer. I also tried a few things, however none of them returned the value from the group field.

    As a workaround, my approach to meet this requirement was:

    – Create a new Record Type with the same field names / types returned from the original Saved Search (acting as a Temporary table).

    – Execute the Saved Search using the API nlapiSearchRecord getting the grouped data and insert them to the temporary table.

    – Create a new Saved Search based on the temporary table.

    – Use the addSearchResults method to add the new Saved Search results, and nlapiXMLToPDF in order to generate the PDF result.

    – Delete data from the temporary table.

    This approach required a lot of additional effort. Does anyone know if there is an easier way to print these grouped fields?

    Thank you.

    Marcel

  • #2134

    samzad

    yes it is possible to do so, you have create an xml pdf template in file cabinet and reference it using the following API

    nlapiCreateTemplateRenderer

    nlapiLoadFile

    nlapiXMLToPDF(xml) then use freemarker syntax to display the search results – you may need to look into freemarker resources for directions (also in stackoverflow)

    note – use freemarker syntax ,

    http://freemarker.org/docs/dgui.html

  • #2135

    marcelp

    Sam,

    In the case, the issue is not the Freemarker syntax itself.

    When using a reference to a regular field from a Saved Search, it works well. Ex:

    ${record.custrecord_fieldname}

    However, if the Saved Search has fields with a summary type (GROUP / MAX / SUM / COUNT, etc), using the same Freemarker syntax does not work, the field is not displayed (it returns a blank value).

    That’s why I had to implement a few more steps to populate a new record type and create a Saved Search with fields that do not have a summary type.

    Thank you.

You must be logged in to reply to this topic.