与交叉表的日历在jasperreports [英] Calendar with crosstab in jasperreports

查看:244
本文介绍了与交叉表的日历在jasperreports的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用jasperreports以日历的形式创建交叉表(年份作为第一组,月份作为列中的第二组)。我正在使用MySQL数据库。

I want to create a crosstab in the form of a calendar (Years as first group and months as second group in the columns) with jasperreports. I'm using MySQL database.

1)第一个问题是,我只得到测量存在的月份,我想显示一年中的所有月份该措施是否存在于本月或不存在。

1) The first problem is, I'm getting only the months where the measure exists, I want to display all months of the year wether the measure exists for this month or not.

2)其次,我希望在单独的页面中每年都有一个单独的交叉表。

2) Second, I want to have a seperate crosstab for every year in a seperate page.

3)我无法按照正确的顺序获得月份,按字母顺序排列。

3) I can't get the months in the right order, they're ordered in alphabetical order.

4)我'在交叉表显示之前得到一个空白的第一页我想摆脱。 (我把我的交叉号放在摘要乐队中)。

4) I'm getting a blank first page before the crosstab displays I wanna get rid of. (I'm putting my crosstab in the summary band).

我知道这些问题太多了,但是我真的非常认真地看着它们而没有任何结果:'(

I know these are too much to ask, but I really looked them up deseperatly without any result :'(

推荐答案

对于大多数情况,你可以在sql中解决这个问题。

For most of this you can fix this in your sql.

1)参见获取两个日期之间的日期列表

3)在你的sql中添加一个列并按顺序排序。示例 SELECT MONTH('2008-02-03'); 将返回2

3) add a column to your sql and order by it. example SELECT MONTH('2008-02-03'); will return "2"

对于#2你可以在Jasper中创建一个组(您也可以将其创建为sql列或使用java日期函数)为该组设置 start on new page 选项。然后将交叉表移动到详细信息区域。

For #2 you can create a group in Jasper of year (you can create this as a sql column as well or use the java date functions) set the start on new page option for the group. then move your crosstab into the detail band.

我认为#2也将解决#4问题。

i think #2 will fix the #4 problem as well.

这篇关于与交叉表的日历在jasperreports的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆