Jasper iReport 复杂交叉表列和行

发布于 2024-12-29 23:13:29 字数 1683 浏览 0 评论 0原文

我想用 Jasper iReport 创建一个交叉表报表,其布局如下

**Date: 1 January 2012**
    Num  Transaction        Blue      Red       Total
    1   | Bank Wire     |     2   |    5    |     7
    2   | Credit Card   |     1   |    2    |     3
    3   | Cheque        |     1   |    1    |     2
    ------------------------------------------------
    Total 
    Bank Wire & Credit  |     3   |    7    |    10
    ------------------------------------------------
    Total All           |     4   |    8    |    12  


**Date: 2 January 2012**
    Num  Transaction        Blue      Red       Total
    1   | Bank Wire     |     0   |    1    |     1
    2   | Credit Card   |     2   |    2    |     4
    3   | Cheque        |     1   |    1    |     2
    ------------------------------------------------
    Total 
    Bank Wire & Credit  |     2   |    3    |     5
    ------------------------------------------------
    Total All           |     3   |    4    |     7 


    --------------------------xx-----------------------
    --------------------------xx-----------------------
    Total 
    All Bank Wire 
    & Credit            |     5   |    10   |    15
    ----------------------------------------------------
    Total
    All Transaction     |     7   |    12   |    19
    --------------------------xx-----------------------
    --------------------------xx-----------------------

它非常复杂,以我自己的逻辑思维,我觉得它是子报表中的交叉表?而且交叉表不允许添加单列或行,只能添加行组,所以这有点困难。

现在我只能创建一个带有事务、蓝色、红色和总计列的交叉表, 以及所有银行电汇总计 不过,信用和所有交易总额

我仍然无法完成“Num”列!

另外,我只能在整个日期范围(1 月 1 日至 2 日)内进行交叉表计数,而不是对每个日期进行交叉表计数。根据每个日期的信用和总计

Jasper iReport 论坛似乎也不活跃。

I want to create a crosstab report with Jasper iReport that has layout like this

**Date: 1 January 2012**
    Num  Transaction        Blue      Red       Total
    1   | Bank Wire     |     2   |    5    |     7
    2   | Credit Card   |     1   |    2    |     3
    3   | Cheque        |     1   |    1    |     2
    ------------------------------------------------
    Total 
    Bank Wire & Credit  |     3   |    7    |    10
    ------------------------------------------------
    Total All           |     4   |    8    |    12  


**Date: 2 January 2012**
    Num  Transaction        Blue      Red       Total
    1   | Bank Wire     |     0   |    1    |     1
    2   | Credit Card   |     2   |    2    |     4
    3   | Cheque        |     1   |    1    |     2
    ------------------------------------------------
    Total 
    Bank Wire & Credit  |     2   |    3    |     5
    ------------------------------------------------
    Total All           |     3   |    4    |     7 


    --------------------------xx-----------------------
    --------------------------xx-----------------------
    Total 
    All Bank Wire 
    & Credit            |     5   |    10   |    15
    ----------------------------------------------------
    Total
    All Transaction     |     7   |    12   |    19
    --------------------------xx-----------------------
    --------------------------xx-----------------------

It is very complex, and in my own logic thinking I feel like its a crosstab in a subreport? And also Crosstab doesnt allow addition of single column or row, only row groups so that is a bit difficult..

Right now I can only create a crosstab with a Transaction, Blue, Red and Total column,
and Total All Bank Wire & Credit and Total All Transaction

I still can't do Num column, though!

Also, I can only make a crosstab counts in the whole date range (1 to 2 January) instead of for each date.. so I still can't do Total Bank Wire & Credit and Total All according to each date

Jasper iReport forum also doesn't seem to be active..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小耗子 2025-01-05 23:13:29

我正在使用 SQL。我通过将交叉表放入详细信息带中并使用该交叉表的子数据集解决了日期问题。

-我的主数据集有参数FromDate和ToDate,它的查询看起来像这样

SELECT Date FROM Table WHERE Date BETWEEN $P{FromDate} AND $P{ToDate}

现在我的主数据集有字段Date

-然后我用参数PDate创建了新的子数据集,它的查询有点像这样

SELECT columnName FROM Table WHERE Date = $P{PDate}

-然后在交叉表数据中,在参数中,我在参数 PDate 中添加主数据集中的表达式 F{Date} ,以便将它们链接在一起。

希望这对任何人都有帮助。

I'm using SQL. I solved the date issue by putting my crosstab in the detail band, and use a sub dataset for that crosstab.

-My main dataset has parameters FromDate and ToDate, its query looks something like this

SELECT Date FROM Table WHERE Date BETWEEN $P{FromDate} AND $P{ToDate}

So now my main dataset has field Date

-Then I created new sub dataset with a parameter PDate and its query is sort of like this

SELECT columnName FROM Table WHERE Date = $P{PDate}

-Then in the Crosstab Data, in Parameters, I add in parameter PDate with expression F{Date} from the main dataset so that they will be linked together.

Hope this helps anyone.

白龙吟 2025-01-05 23:13:29

可以通过添加行组和计数变量作为其表达式来创建“Num”列。此外,为了进行正确的计数,请创建一个“日期”组并将交叉表放在该组的页脚中。

'Num' column can be created by adding a row group and a count variable as it's expression. Also, for making correct counts, create a 'Date' group and put the crosstab in that group's footer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文