Jump to content
We've recently updated our Privacy Statement, available here ×

Or condition in field "Print when Expression" for frame


ye_l

Recommended Posts

In the Print when Expression field, I put the following condition to show or hide the frame:

IF((($F{imp_item_revision_id_1}.isEmpty()==false) || ($F{sol_item_revision_id_1}.isEmpty()==false)), Boolean.TRUE,Boolean.FALSE)

If one of the two conditions is true, the frame should be displayed.
But if the first is false and the second is true, in this case the frame disappears. I dont understand why? 
 

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Why so complex syntax? 

Just try:

!$F{imp_item_revision_id_1}.isEmpty() || !$F{sol_item_revision_id_1}.isEmpty()[/code]

for your printWhenExpression to let the frame printed when one of the two field isn't empty

Be aware if the field contents are null ... then you could use apache StringUtils.isNotEmpty Method that is "null-safe":

eg:

StringUtils.isNotEmpty($F{imp_item_revision_id_1}) || StringUtils.isNotEmpty($F{sol_item_revision_id_1})[/code]

hth + regards

C-Box

Link to comment
Share on other sites

It may be that you have a null in $F{sol_item_v}. This will cause .isEmpty() to be null so the condition would be false.

Try this.

Objects.nonNull($F{imp_item_revision_id_1}) && Objects.nonNull($F{sol_item_revision_id_1}) && ($F{imp_item_revision_id_1}.length() + $F{sol_item_revision_id_1}.length() > 0)

 

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...