如何通过将一个查询的输出作为另一个查询的输入来创建 jasper 报告
我尝试使用数据集。但是如何将一个数据集查询输出作为另一个数据集的输入。
例如,资产负债表类型报表视图。
我的第一个查询是
SELECT column_name_one FROM table WHERE C_GL_PRIMARY='LIABILITY'
假设此查询返回 2 行,例如 DEPOSIT、LOAN。 我的第二个查询是
SELECT colum_name_second FROM table WHERE C_GL_ONE='column_name_one'
(我使用数据网格完成并且正在工作)
例如
DEPOSIT
term deposit
pigmy deposit
LOANS
term loan
pigmy loan
直到这里一切都很好,但现在我还有一个查询需要第二个查询的输出作为该查询的输入。
select column_name_third from table where C_GL_TWO='colum_name_second'
在这里,我无法将“colum_name_second”作为输入,因为该字段位于列表下,而不是详细信息。
我的报告应该如下所示
DEPOSIT
term deposit
new term deposit
old term deposit
pigmy deposit
ww pigmy deposit
bbb deposit
LOANS
term loan
new tem loan
current term loan
pigmy loan
pigmyloannew
有人可以帮助我吗...有什么办法可以做到这一点。
谢谢。
I tried using dataset. But how can I give one dataset queries output as input to another dataset.
For example, balancesheet type report view.
My first query is
SELECT column_name_one FROM table WHERE C_GL_PRIMARY='LIABILITY'
Suppose this query returns me 2 rows, like DEPOSIT,LOAN.
My second query is
SELECT colum_name_second FROM table WHERE C_GL_ONE='column_name_one'
(i did it using datagrid and is working)
for example
DEPOSIT
term deposit
pigmy deposit
LOANS
term loan
pigmy loan
Till here everything is fine but now i have one more query which need output of second query as input for this query.
select column_name_third from table where C_GL_TWO='colum_name_second'
Here i am not able to put "colum_name_second" as input becoz it this fiels is under list not in details..
My report should look like this
DEPOSIT
term deposit
new term deposit
old term deposit
pigmy deposit
ww pigmy deposit
bbb deposit
LOANS
term loan
new tem loan
current term loan
pigmy loan
pigmyloannew
Can anybody help me ...Is there any way to do it.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
1ST-在主报告查询中创建参数,并在 HashMap 中输入参数值以填充它。
2nd-在数据集中创建参数并在数据集查询中使用该参数。$p{Dataset_parameter}
3rd-如果您使用列表组件,右键单击然后转到编辑列表数据源,然后单击参数,然后添加数据集参数并使用主查询输出属性对其进行配置。
1ST-Create the Parameter in Main report query and enter the parameter value in HashMap to populate it.
2nd-Create the parameter in dataset and use the parameter in dataset query.$p{Dataset_parameter}
3rd-If you are using List component right click on then go Edit list data source then click parameter then add the parameter of dataset and configure it with Main query output attribute.
根据您的描述,这应该只是一个查询:
然后报告将被分组以完全按照您所需的报告输出显示数据。
From your description this should just be a single query:
Then the report would be grouped to show the data exactly as in your desired report output.