In my ireport, The parameter will print out if the parameter isn't null.
But I also want to print out "Default to all" if the parameter is null.
How do i write that expression using boolean? Im sorry I'm very new to this and hope you guys can help me out.following is the expression I'm using to print out my parameter.
new Boolean($P{checkedDepartment}!= null)
Leave the printWhenExpression
blank so that the element is always shown, then change the textFieldExpression
to:
($P{checkedDepartment} != null) ? $P{checkedDepartment} : "Default to all"
This uses the java conditional operator , in case you are not familiar with it.
Try this:-
$P{p_firstname} == null? " All " :
(
$P{p_firstname}.isEmpty() ? " All ":
$P{p_firstname}
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.