Report generation takes too much time .



  • just multiply the contents in the "data:[ ]"



  • yes, I am asking how many items you have there in the end.



  • Sure.In the Data[ ] list "INC[ ]" array has a list of 40000 indexes.



  • ok so I do something like this with a custom script to multiply data

    function beforeRender(req, res) {
        for (let i = 0; i < 400; i++) {
            req.data.Data[0].INC.push(req.data.Data[0].INC[0])
        }     
    }  
    

    With 400 more items, it takes 10s to chrome to do the html conversion and produces 146 pages.
    With your expected data, 40 000 items, it is 100x more so you expect the result of 14 600 pages?

    This will be very hard to optimize to 4min. The majority of the rendering time is used by chrome to do the html->pdf conversion and this is something we have no influence on. You could try to replace the table elements with divs which are typically faster, but you would lose some layout features table provides.

    One option is to split the big report to the chunks and do the printing in parallel to employ all the cpu cores, because chrome typically uses just cone core. I uploaded here a demo how it could work, please check it out and let me know if you have some good results with it
    https://1drv.ms/u/s!AogtKyPn-GjbhLZ0wLCCU6HHdZAyQw?e=ENQWx6



  • I checked with that parallel script with large data. it results in me showing error like .

    Error: Render cycle detected. Template at /Atims Reports/System/Active Roster/Active Roster - Detail/Active Roster - Detail was rendered previously in this render request (hierarchy: /Atims Reports/System/Active Roster/Active Roster - Detail/Active Roster - Detail -> /Atims Reports/System/Active Roster/Active Roster - Detail/Active Roster - Detail). Please verify that reporter.render is not causing cycle
    at process.<anonymous> (E:\V2SOURCE\JS REPORT\node_modules\script-manager\lib\worker-processes.js:55:23)
    at process.emit (events.js:200:13)
    at emit (internal/child_process.js:876:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:9)



  • Please try to share a minimal demo in playground that replicates the issue.



  • Hi, now I achieved it through .net itself so I get JSON data and assign it into an object array. further, I divide them into multiple chunks finally I pass the list of array objects into the report and merge the report parallelly. In my case, I am using chrome PDF. we had JSON data inside the "Data" object at the end of report we fetch {{Data. length}} to take count of persons. But now after dividing data into multiple chunks. Total count repeating for every chunk data. How I can resolve the issue. I need total counts at the end of the report at once only.



  • I'm not sure I get exactly what you do.
    But seems like you just add some extra variable to the last chunk and based on that display the total count or not.



  • Hi,
    Exactly the same scenario only I am trying. adding one extra variable in the last chunk based on what I am trying to display. But in these, I am facing one difficulty. I have to fetch the count of the "Total person" value from the stored procedure itself. Normally, We return Json structure result in the Stored procedure. So Count function making some difficulties in querying. Instead of there is any chance to write a script in the jsreport. kind of After render process and merge all the chunks and find out the length of the total count.




Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.