是否有可能在jasper中使用此记录获取此类布局以及如何执行此操作?
color_table
id | color_group | description
1 | primary | the first
2 | secondary | the second
3 | tertiary | the third
color_table_details
color_table_id | color
1 | red
1 | blue
1 | yellow
2 | orange
2 | violet
2 | green
3 | etc
我想要的布局如下。
id color group description color
1 primary the first red
blue
yellow
2 secondary the second orange
violet
green
答案 0 :(得分:1)
我用以下解决方案解决了这个问题:
1. Added report group to the report
2. Added new variable with type of string (var_name)
3. On the variable expression property of the variable,
$V{var_name} == null || ${var_name} == ""
? "1"
: ${var_name} + ", 1"
4. Set the reset type of your variable to **Report** and its reset group to the report group you created at step 1
5. Then on your report layout, edit the text field expression of your id, color group and description to the following
$V{var_name} == "1"
? ${field_name}
: ""