Large Dataset Export with the New Calculation Engine Enabled

  • Last update:December 23, 2025
  • Overview

    Version

    Report Server Version 
    Functional Change
    11.0

    /

    11.0.10

    Added support for exporting data to CSV files with a custom encoding format.

    Application Scenario

    The new calculation engine helps address the problem of slow loading during template previews, but exporting datasets is relatively slow. In this case, this document provides you with a solution to resolve this problem.

    iconNote:
    This document introduces how to export the data from the dataset used in the template, not the template itself.

    Implementation Method

    Slow dataset export is primarily caused by computing all templates before exporting datasets in the templates. Therefore, as long as the new calculation engine supports large dataset export, this problem will be resolved.

    By adding a custom button on the toolbar and defining a custom JavaScript event, you can export large datasets with a significantly improved speed.

    iconNote:

    1. Both CPT and CPTX formats are supported. CPTX templates refer to reports created in FineReport of V10.0 with the new calculation engine enabled.

    2. The data to be exported should not exceed 10 million rows x 20 columns, because if the data volume is extremely large, only a portion of the data may be exported.

    Example One: FineReport of Versions Before 11.0.10

    Custom Button

    1. Download and open the template Row-based Report.cpt. New Calculation Engine is enabled in this template. For details, see Usage Instruction to the New Calculation Engine.

    2. Choose Template > Web Attribute > Pagination Preview Setting, and select Set for This Template Separately from the Following Settings: drop-down box, as shown in the following figure.

     1.png

    3. Add a custom button to the toolbar, and click the    icon in Top Toolbar, as shown in the following figure.

     2.png

    4. Set Widget Alias of the custom button to Large Dataset Export, and click Custom Event, as shown in the following figure.

     3.png

    5. In the Set Callback Function window, enter the JavaScript code, as shown in the following figure.

     设置回调函数.png

    The JavaScript code is as follows:

    // The name of the datasets to be exported: You can use encodeURIComponent to prevent Chinese characters from garbling.
        var dsName = encodeURIComponent("ds1");
        // The server address: The IP address, port number, and web application name should be adjusted according to the actual situation.
        var url = "http://localhost:8075/webroot/decision/url/report/v10/direct/export" + "?sessionID=" + Report.SessionMgr.get() + "&dsName=" + dsName;
        // The following section is for exporting the dataset as a form.
        var form = $("<form>");
        $("body").append(form);
        if (url.indexOf('?') !== -1) {
            var q = url.substr(url.indexOf('?') + 1);
            var qs = q.split('&');
            for (var i = 0; i < qs.length; i++) {
                var p = qs[i];
                var ps = p.split('=');
                if (ps.length === 2) {
                    $('<input/>').attr('name', ps[0]).val(ps[1]).appendTo(form);
                }
            }
            url = url.substring(0, url.indexOf('?'));
        } else {
            var input = $("<input>");
            form.append(input);
        }
        form.attr({"style": "display : none", "target": "", "method": "post", "action": url});
        form.submit();
        form.remove();

    Effect Preview

    Save the report and click Pagination Preview. The following figure shows the preview effect.

     gif5.gif

    Template Download

    For details, you can download the template: Large Dataset Export with the New Calculation Engine Enabled.cpt

    Example Two: FineReport V11.0.10 and Later Versions

    Custom Button

    1. Download and open the template Row-based Report.cpt. New Calculation Engine is enabled in this template. For details, see Usage Instruction to the New Calculation Engine.

    2. Choose Template > Web Attribute > Pagination Preview Setting, and select Set for This Template Separately from the drop-down list of Following Settings, as shown in the following figure.

     6.png

    3. Add a custom button to the toolbar, and click the   icon in Top Toolbar, as shown in the following figure.

     7.png

    4. Set Widget Alias of the custom button to Large Dataset Export, and click Custom Event, as shown in the following figure.

     8.png

    5. In the Set Callback Function window, enter the JavaScript code, as shown in the following figure.

     例二-设置回调函数.png

    The JavaScript code is as follows:

    iconNote:
    To export the data to an Excel file, you should enter exportFormat = " ", and encodeFormat = " " in the code, which means leaving the two parameters empty.

    // The name of the datasets to be exported: You can use encodeURIComponent to prevent Chinese characters from garbling.
        var dsName = encodeURIComponent("ds1");
        //Format of the exported file: The default format is Excel if not specified.
        var exportFormat = "csv"
        //The encoding type of the exported file: This setting is only effective when the export format is CSV.
        var encodeFormat = "UTF - 8"
        // The server address: The IP address, port number, and web application name should be adjusted according to the actual situation.
        var url = "http://localhost:8075/webroot/decision/url/report/v10/direct/export" + "?sessionID=" + Report.SessionMgr.get() + "&dsName=" + dsName + "&exportFormat=" + exportFormat + "&encodeFormat=" + encodeFormat ;
        // The following code is used to export the dataset as a form.
        var form = $("<form>");
        $("body").append(form);
        if (url.indexOf('?') !== -1) {
            var q = url.substr(url.indexOf('?') + 1);
            var qs = q.split('&');
            for (var i = 0; i < qs.length; i++) {
                var p = qs[i];
                var ps = p.split('=');
                if (ps.length === 2) {
                    $('<input/>').attr('name', ps[0]).val(ps[1]).appendTo(form);
                }
            }
            url = url.substring(0, url.indexOf('?'));
        } else {
            var input = $("<input>");
            form.append(input);
        }
        form.attr({"style": "display : none", "target": "", "method": "post", "action": url});
        form.submit();
        form.remove();

    Effect Preview

    Save the report and click Pagination Preview. The following figure shows the effect.

     10.png

    Template Download

    For details, you can download the template: Large Dataset Export with the New Calculation Engine Enabled - Example Two.cpt

    Other Description

    Export with Parameters

    For details, you can download the template: Parameter Linkage in Drop-down Box Widgets.cpt

    If you want to export templates with parameters, you can filter parameters on the parameter panel. For details about specific settings, see Parameter Linkage Among Drop-down Boxes by SQL Statements.

    The settings of the custom button are shown in the following figure.

     11.png

    Other steps are the same as in the section "Example One: FineReport of Versions Before 11.0.10". The JavaScript code is as follows:

    // The name of the datasets to be exported: You can use encodeURIComponent to prevent Chinese characters from garbling.
        var dsName = encodeURIComponent("ds1");
        // The server address: The IP address, port number, and web application name should be adjusted according to the actual situation.
        var url = "http://localhost:8075/webroot/decision/url/report/v10/direct/export" + "?sessionID=" + Report.SessionMgr.get() + "&dsName=" + dsName + "&area=" + a + "&province=" + b + "&city=" + c ;
        // The following code is used for exporting the dataset as a form.
        var form = $("<form>");
        $("body").append(form);
        if (url.indexOf('?') !== -1) {
            var q = url.substr(url.indexOf('?') + 1);
            var qs = q.split('&');
            for (var i = 0; i < qs.length; i++) {
                var p = qs[i];
                var ps = p.split('=');
                if (ps.length === 2) {
                    $('<input/>').attr('name', ps[0]).val(ps[1]).appendTo(form);
                }
            }
            url = url.substring(0, url.indexOf('?'));
        } else {
            var input = $("<input>");
            form.append(input);
        }
        form.attr({"style": "display : none", "target": "", "method": "post", "action": url});
        form.submit();
        form.remove();

    Attachment List


    Theme: Performance Optimization
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy