Using Cascading inputs with API/Web Services for JasperReports JasperServer 4.0

為{幸葍}努か 提交于 2021-02-07 08:18:43

问题


Quick preface. My company is actually paying for Jasper support, but they have been unable to help me. At this point googling for the answer only leads me to my own unanswered forum threads on their site. I am going crazy.

I am having a terrible time writing code to handle cascading inputs with Jasper's Web Services API. Their web services sample web app does not handle this (even though this feature is something they have been heavily pimping since 3.7). The only place where I have found an example is in about 15 lines of code from their Web Services documentation (a 64 page pdf). However there is no explanation as to what it is doing.

Has anyone been able to implement this? Can you give a simple example, with some kind of logical explanation?

Here is a dumb scenario (feel free to make up your own)

I have a report with 2 inputs inputA and inputB where the choice for A effects the choices shown for B. So inputA gives me the choices "Cat", "Dog", "Bird". I decide to pick "Dog" for inputA. inputB should then give me the options: "Poodle", "Labrador", "Mutt".

How can I take the "Dog" choice for inputA and use the jasper web services to figure out those 3 options for inputB?

I am really looking for code samples with some kind of explanation.

And again. I am going crazy.


回答1:


In ireports you can create input controls. Go to properties by right clicking the input control that would be your 2nd parameter. In Properties->Input Control Details Tab->Edit Local Resource now go to the query tab

Add a query with the first select box value as a parameter.This parameter should be declared in your report under the parameters section.

Query for example select reqtitle,clientname from hc_requisitions inner join hc_clients on hc_clients.rid=hc_requisitions.clientid where clientname=$P{clientname}

where $P{clientname} is the value from the first select box.

Hope it helps!



来源:https://stackoverflow.com/questions/5774923/using-cascading-inputs-with-api-web-services-for-jasperreports-jasperserver-4-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!