zoukankan      html  css  js  c++  java
  • 报表往子报表里传入list

    js

    var _parameters = {
        reportFileName: "reports/doctorstation/labBioResult.jasper",
        parameters: {
            'order_Id': $scope.selectedExamLabOrdersVO.orderId,
            'bioList' : bioList,
            'hasAnti' : hasAnti,
            'labAntiList' : labAntiList
        }
    };
    var printInfoObject = {
        type: "report",
        method: "post",
        appletParameters: {
            is_direct_print: true,
            is_display: false,
            printer_name: null,
            report_url: "api/jasper-prints/doctor-station/lab-bio-results"
        },
        reportParameter: _parameters
    };
    HrUtils.postMessageToBaseFrame(printInfoObject, "*");

    报表服务器的facade里写法

    public JasperPrint fillLabBioResultReport(JasperPrintParamsVo jasperPrintParamsVo) {
        LOGGER.debug("填充报表[{}];填充时使用参数:[{}]。", jasperPrintParamsVo.getReportFileName(), jasperPrintParamsVo.getParameters());
        Map reportParam = jasperPrintParamsVo.getParameters();
        List<Map<String, ?>> bioList = (List<Map<String, ?>>) jasperPrintParamsVo.getParameters().get("bioList");
        List<Map<String, ?>> labAntiList = (List<Map<String, ?>>) jasperPrintParamsVo.getParameters().get("labAntiList");
        reportParam.put("bioList", new JRMapCollectionDataSource(bioList));
        reportParam.put("labAntiList", new JRMapCollectionDataSource(labAntiList));
        reportParam.put("SUBREPORT_DIR", "reports/doctorstation/");
        return hrFillReport(obtainJasperReportByFileName(jasperPrintParamsVo.getReportFileName()), reportParam, new JREmptyDataSource());
    }

    报表写法注意

    detail1中循环的是bioList中的数据 detail3中循环的是labAntiList中的数据

    报表中传入的bioList和labAntiList的类型要注意(net.sf.jasperreports.engine.data.JRMapCollectionDataSource)

    连接子报表注意

    之前用sql做子报表是下面两个红框有内容(Connection Expression是自动生成的)

    现在往子报表中传list是先要把Connection Expression中的值删除然后在紫框中(Data Source Expression)填入($P{bioList}.cloneDataSource())

      $P{bioList}是要往子报表中传的list也是主报表中的parameter的值

  • 相关阅读:
    c语言网络编程过程及函数说明
    c代码编译完整过程详解
    const关键字的常见作用
    c语言中static关键字的几个作用
    c语言结构体中字节对齐方式
    modbus协议数据格式
    CodeForces
    如何在Dev-Cpp中使用C++11中的函数:stoi、to_string、unordered_map、unordered_set、auto
    关于lower_bound( )和upper_bound( )的常见用法
    CodeForces 600C——思维
  • 原文地址:https://www.cnblogs.com/ms-grf/p/7561796.html
Copyright © 2011-2022 走看看