JasperReports: "Invalid field mapping" / "line 1:1: unexpected token: [Measures]" 错误 XML-A 数据源 (Olap



我正在构建一个Java服务,它使用olap数据源(XML-a服务器)生成报告(使用JasperReports 4.0.5库)。在iReport上,我编写了XMLA-MDX查询,并正确地可视化了预览。但当我在Java中运行它时,我在执行时收到错误"行1:1:意外的令牌:[Measures]"!详细信息显示:net.sf.jasperreports.engine.JRRuntimeException:无效字段映射"[Measures]。[全价]"。这是代码:

 try{
      net.sf.jasperreports.engine.util.JRProperties.setProperty("net.sf.jasperreports.query.executer.factory.xmla-mdx", "net.sf.jasperreports.olap.xmla.JRXmlaQueryExecuterFactory");
      String url = "http://localhost/olap/msmdpump.dll";
      String ds = "localhost";
      String cat = "MyCat";
      Map parameters = new HashMap();
      parameters.put(JRXmlaQueryExecuterFactory.PARAMETER_XMLA_DATASOURCE, ds);
      parameters.put(JRXmlaQueryExecuterFactory.PARAMETER_XMLA_CATALOG, cat);
      parameters.put(JRXmlaQueryExecuterFactory.PARAMETER_XMLA_URL, url);
      String fileJasper = "I:\Work\prod_ireport\myOlapReport.jasper";
      JasperPrint jp = JasperFillManager.fillReport(fileJasper, parameters);
 }
 catch (Exception e) {
      System.out.println(e.getMessage());
 }

这是jrxml文件中的MDX-XMLA查询

SELECT
  NON EMPTY {
    [Measures].[Full price]
  , [Measures].[Promo price]
  } ON COLUMNS,
  NON EMPTY {
    [Items].[Items Hierarchy].[Repo].Members
  , [Items].[Items Hierarchy].[Family].Members
  } ON ROWS
  FROM [MY CUBE]

我哪里做错了?

try:

SELECT
  NON EMPTY ({
    [Measures].[Full price]
  , [Measures].[Promo price]
  }) ON COLUMNS,
  NON EMPTY ({
    [Items].[Items Hierarchy].[Repo].Members
  , [Items].[Items Hierarchy].[Family].Members
  }) ON ROWS
  FROM [MY CUBE]

相关内容

  • 没有找到相关文章

最新更新