Reputation: 31
I'm using iReport 4.7.1. The report contains a static field "Date Validated:" and a text field "$P{DATE_VALIDATED}" which i can confirm is "" empty. I want to hide "Date Validated: " text when $P is empty.
I have tried the following so far:
I have added the following line in the property (print when expression) of the static field which has static text "Date Validated: " :
$P{DATE_VALIDATED} == "" ? new Boolean(false) : new Boolean(true)
I also tried the following variations:
$P{DATE_VALIDATED} == "" ? "" : "Date Validated:"
$P{DATE_VALIDATED} == "" ? Boolean.FALSE : Boolean.TRUE
But static field is still showing up. I also tried putting just Boolean.FALSE to hide it completely to test and see but text is still showing up.
Upvotes: 1
Views: 3463
Reputation: 31
Thanks viki888 for the quick answer, that's an improvement to what i am trying to do, i'll up vote it, but the problem in my situation was i wasn't Compiling the Report after saving it, because i didn't know i had to and there isn't an obvious option/menu item or icon except tiny little hammer on the toolbar on designer window that says Compile Report... :)
So in my case compiling the report solved the problem for me. and
$P{DATE_VALIDATED} == "" ? Boolean.FALSE : Boolean.TRUE
is working fine.
Upvotes: 1
Reputation: 2774
You can try the below expression in print when condition
!$F{DATE_VALIDATED}.isEmpty() && $F{DATE_VALIDATED} != null && $F{DATE_VALIDATED} != ""
Hope this should solve your problem.
Upvotes: 1