Jasper reports 使用组的问题:当值为空时,如何为特定列设置背景色

Jasper reports 使用组的问题:当值为空时,如何为特定列设置背景色,jasper-reports,Jasper Reports,我在报告中有一个名为totalhours的列,当名为outtime的列的值为null时,我想将颜色设置回黄色。为此,我创建了一个条件样式,包含以下详细信息: 上面的代码给出了以下输出 SlNo. empid intime outime totalhours 1 100 9:00 13:00 4:00 2 101 9:10 null

我在报告中有一个名为
totalhours
的列,当名为
outtime
的列的值为
null
时,我想将颜色设置回
黄色。为此,我创建了一个条件样式,包含以下详细信息:


上面的代码给出了以下输出

SlNo. empid intime outime totalhours 1 100 9:00 13:00 4:00 2 101 9:10 null yellow 3 105 9:30 13:30 14:30 null 4 103 9:30 18:30 9:00 5 107 9:40 13:40 8:00 14:40 18:40 6 108 10:00 null yellow 7 106 10:00 13:00 14:00 null 斯莱诺。empid intime outime总小时数 1 100 9:00 13:00 4:00 21019:10零黄色 3 105 9:30 13:30 14:30零 4 103 9:30 18:30 9:00 5 107 9:40 13:40 8:00 14:40 18:40 6108 10:00零黄色 7 106 10:00 13:00 14:00零 但是,我希望输出如下:

SlNo. empid intime outime totalhours 1 100 9:00 13:00 4:00 2 101 9:10 null yellow 3 105 9:30 13:30 yellow 14:30 null 4 103 9:30 18:30 9:00 5 107 9:40 13:40 8:00 14:40 18:40 6 108 10:00 null yellow 7 106 10:00 13:00 yellow 14:00 null 斯莱诺。empid intime outime总小时数 1 100 9:00 13:00 4:00 21019:10零黄色 31059:30 13:30黄色 14:30零 4 103 9:30 18:30 9:00 5 107 9:40 13:40 8:00 14:40 18:40 6108 10:00零黄色 7 106 10:00 13:00黄色 14:00零 请查找jrxml文件:



任何人都可以帮助我如何获取它

您应该将带有样式文本(带有$F{TotalHours}表达式)的文本字段的evaluationTime属性更改为Band

工作样本

输入数据,csv数据源:

EmployeeID,In_time,Out_time,TotalHours,FirstName,LastName,EmployeeNo
101,9:00,13:00,4:00,Filippo,Inzaghi,1
102,10:00,,,Zineddin,Zidan,2
102,10:00,,,Zineddin,Zidan,2
103,10:00,15:00,5:00,Andriy,Shevchenko,3
103,10:00,16:00,6:00,Andriy,Shevchenko,3
103,10:00,,,Andriy,Shevchenko,3
104,8:00,15:00,7:00,Gennaro,Gattuso,4
104,8:00,10:00,2:00,Gennaro,Gattuso,4
jrxml文件: