我使用 Jaspersoft Studio 准备了JRXMl。我使用了预定义的逻辑函数,如IF。 当我尝试在java中集成时,(我想从Java程序使用JRXML生成报告)我收到以下错误:
cannot find symbol
symbol : method DATEFORMAT(java.util.Date,java.lang.String)
location: class ServiceLevelAnalysis_1407129001044_460064
value = IF(((java.util.Date)parameter_Fromdate.getValue()).getYear()==0,"Open Invoices",DATEFORMAT(((java.util.Date)parameter_Fromdate.getValue()),"MM/dd/yy")+" - " +DATEFORMAT(((java.util.Date)parameter_ToDate.getValue()),"MM/dd/yy")); //$JR_EXPR_ID=10$
^
D:\MSIJasper\MSIJasperDemo\ServiceLevelAnalysis_1407129001044_460064.java:259: cannot find symbol
symbol : method DATEFORMAT(java.util.Date,java.lang.String)
location: class ServiceLevelAnalysis_1407129001044_460064
value = IF(((java.util.Date)parameter_Fromdate.getValue()).getYear()==0,"Open Invoices",DATEFORMAT(((java.util.Date)parameter_Fromdate.getValue()),"MM/dd/yy")+" - " +DATEFORMAT(((java.util.Date)parameter_ToDate.getValue()),"MM/dd/yy")); //$JR_EXPR_ID=10$
我需要添加哪个jar来解决此问题? 我的代码是
JasperReport jasperReport = JasperCompileManager.compileReport("D:\\JaspersoftStudioWorkspace\\MyReports\\ServiceLevelAnalysis.jrxml");
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,new HashMap(), new JREmptyDataSource());
JasperExportManager.exportReportToPdfFile(jasperPrint, "D:\\JaspersoftStudioWorkspace\\MyReports\\sample.pdf");
请帮帮我。