如何在JRxml文件中创建动态列以生成jasper报告? [英] How to create dynamic columns in JRxml file for jasper report generation?

查看:680
本文介绍了如何在JRxml文件中创建动态列以生成jasper报告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组数据以表格格式显示,使用jasper报告并且当前正在编写.jrxml文件。

I have a set to data to be shown in a tabular format using jasper report and currently writing the .jrxml file.

在我的数据集中,我有数据将使我们知道表的列数,从而使其成为表的动态列。

In my dataset, i have data which will serve us to know number of columns for the table, hereby making it dynamic columns for table.

因此,问题是从数据库获取的数据是特定于行的;那么我该如何才能将它转换为表格的列数呢?

So, the issue is Data fetched from database is row specific; so how can i make it work to convert it to no of columns for table?

我有一个dB表来从中提取数据:

I have a dB table from where data is pulled up:

TEST_ID   LEVEL   LOT_NUM  MEAN          UNITS       PERCENT            
--------- ------  -------- ------------- ----------- -------------
GLU       1       1212     2.1             10           22                     
GLU       2       1314     3.2             10           22                     
GLU       3       1414     3.3             10           22       

我必须同样创建报告:

TEST_ID   LEVEL:1  LEVEL:2   LEVEL:3  UNITS PERCENT
-------   -------  -------   -------  ----- -------
GLU       2.1      3.2       3.3      10    22

- :LEVEL的数量变为特定测试的列数。

-: Number of LEVEL's becomes the number of columns for particular tests.

推荐答案

您的用例看起来像您的公司lumns只能在运行时识别。对于此类用例,您可以查看两个库中的任何一个 - 动态jasper 动态报告。我已经看到动态jasper比动态报告更多的用法。

Your use case looks like your columns can only be identified at run time. For such use cases,you can look at either of two libraries - dynamic jasper and dynamic reports. I have seen more usage of dynamic jasper over dynamic reports though.

这篇关于如何在JRxml文件中创建动态列以生成jasper报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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