Jump to content

Print When Expression - when (field data) != (field data)


Recommended Posts

Hi There,

I hope you can help with this issue....

I am tying to use the Print When Expression option to print a line when the data within a field changes. I have never used Booleans before and it is confusing me, I have tried the following and none of them have worked!!

  • Boolean($F{CONSIGNMENT}.equals($F{CONSIGNMENT}))
  • Boolean($F{CONSIGNMENT}.notequal($F{CONSIGNMENT}))

and various variations of the above.

Does anyone have any ideas of what I am doing wrong and what needs to be done to make this work properly? I have had it suggested that the easiest solution is to create a sub-report which means that the Print When Expression is no longer required. If its possible I would rather use formatting of the report rather than create a sub-report as that seems tedious for what the report actually shows, particularly when if this works the way I believe it should do....


Thanks in Advance of any adivce...



Post Edited by jimh_1 at 07/28/2011 12:41

Post Edited by jimh_1 at 07/28/2011 12:45
Link to comment
Share on other sites

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

 WOW if it is Oracle Database then you can use the Lag function to compare the previous value with the current value.

For example with lag you will end up getting  rows as below


Previous Row             Current Row

NULL                                  B

B                                         C

C                                         C

C                                         D

so in jasper in the print expression compare Previous Row != Current Row with an additional condition for handling the first row which will have no previous value

Link to comment
Share on other sites

I have got the Lag function within the query working perfectly, but I am still struggling with the script for the Print When Expression.


I have tried:






I must be writing this script incorrectly but I have been unable to find out how it should be phrased...



.... Any ideas?


Link to comment
Share on other sites

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...