将级联输入与 JasperReports JasperServer 4.0 的 API/Web 服务结合使用
快速前言。我的公司实际上正在支付 Jasper 支持费用,但他们一直无法帮助我。此时,通过谷歌搜索答案只会让我找到他们网站上我自己的未答复的论坛主题。我快要疯了。
我在编写代码来使用 Jasper 的 Web 服务 API 处理级联输入时遇到了麻烦。他们的 Web 服务示例 Web 应用程序无法处理此问题(尽管自 3.7 以来他们一直大力支持此功能)。我唯一找到示例的地方是其 Web 服务文档(64 页的 pdf)中的大约 15 行代码。但没有解释它在做什么。
有人能够实现这个吗?您能否给出一个简单示例,并附上某种逻辑解释?
这是一个愚蠢的场景(请随意编造自己的场景)
我有一个包含 2 个输入 inputA 和 inputB 的报告,其中 A 的选择会影响 B 显示的选择。所以 inputA 给了我选择“猫”、“狗”, “鸟”。我决定为 inputA 选择“Dog”。然后 inputB 应该给我选项:“Poodle”、“Labrador”、“Mutt”。
我如何为 inputA 选择“Dog”并使用 jasper Web 服务找出 inputB 的这 3 个选项?
我真的在寻找带有某种解释的代码示例。
又来了。我快要疯了。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在报告中,您可以创建输入控件。
右键单击作为第二个参数的输入控件,转到属性。
在属性->输入控件详细信息选项卡->编辑本地资源
现在转到查询选项卡
添加一个查询,并将第一个选择框值作为参数。此参数应在报告的参数部分下声明。
查询例如
从 hc_requisitions 内部加入 hc_clients 中选择 reqtitle,clientname
hc_clients.rid=hc_requisitions.clientid 其中 clientname=$P{clientname}
其中
$P{clientname}
是第一个选择框中的值。希望有帮助!
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!