简体   繁体   English

通过PHP运行JasperServer报告并传递查询字符串

[英]Run a JasperServer report via PHP and pass over the querystring

I'm using Web Services to run some reports created in iReport on JasperReports Server. 我正在使用Web服务在JasperReports Server上运行在iReport中创建的一些报告。 Inside the .jrxml file I can see the <querystring> xml that holds the SQL for the report. 在.jrxml文件中,我可以看到保存报表SQL的<querystring> xml。 Is it possible to pass this querystring over to JasperServer via Web Services, instead of hard coding the definition inside the .jrxml file. 是否可以通过Web服务将此查询字符串传递给JasperServer,而不是对.jrxml文件中的定义进行硬编码。 This is the string I would build in PHP, then pass over to JasperReports Server to be used in the execution of the report. 这是我将在PHP中构建的字符串,然后传递给JasperReports Server以用于执行报告。

<queryString>
   <![CDATA[SELECT * FROM table WHERE j=2]]>
</queryString>

Basically, I'm trying to find a way to dynamically create the SQL in PHP, then pass the SQL over to Jasper to run the report. 基本上,我试图找到一种在PHP中动态创建SQL,然后将SQL传递给Jasper来运行报表的方法。 Is it even possible? 可能吗?

Found out I could do this by setting up a parameter with $P!{query} instead of using $P{query}. 发现我可以通过使用$ P!{query}而不是使用$ P {query}设置参数来完成此操作。 The "!" “!” makes the difference. 有所作为。 Hope it helps someone else who comes along with the same problem. 希望它可以帮助遇到相同问题的其他人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM