jimh_1 Posted July 28, 2011 Share Posted July 28, 2011 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!! $F{CONSIGNMENT}!=$F{CONSIGNMENT} 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... JimPost Edited by jimh_1 at 07/28/2011 12:41Post Edited by jimh_1 at 07/28/2011 12:45 Link to comment Share on other sites More sharing options...
jasperoily Posted July 28, 2011 Share Posted July 28, 2011 Are you trying to compare the previous row value with the current row and show it only if they are not the same Link to comment Share on other sites More sharing options...
jimh_1 Posted July 28, 2011 Author Share Posted July 28, 2011 thats right yes, whenever the consignment changes, I want iReports to print a line so that it is easily identifiable. is this possible? Link to comment Share on other sites More sharing options...
jasperoily Posted July 28, 2011 Share Posted July 28, 2011 Ideally that should be done in the query itself. Which is the database that is being used ? Link to comment Share on other sites More sharing options...
jimh_1 Posted July 28, 2011 Author Share Posted July 28, 2011 A WMS called Red Prairie which is an Oracle SQL database... ... how would you specify a line being drawn within the query? Sorry if I am being obtuse!!Post Edited by jimh_1 at 07/28/2011 13:51 Link to comment Share on other sites More sharing options...
jasperoily Posted July 28, 2011 Share Posted July 28, 2011 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 RowNULL BB CC CC Dso 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 More sharing options...
jimh_1 Posted July 28, 2011 Author Share Posted July 28, 2011 I will try that and will update the thread with what happens... ....Just need to find out about the Lag function now!! Thank you very much for your help with this Link to comment Share on other sites More sharing options...
jimh_1 Posted July 28, 2011 Author Share Posted July 28, 2011 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: $F{CONSIGNMENT}!=$F{CONSIGNMENT2}Boolean(${CONSIGNMENT}.notequal(${CONSIGNMENT2}))Boolean(${CONSIGNMENT}.equals(${CONSIGNMENT2})) 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 More sharing options...
jasperoily Posted July 28, 2011 Share Posted July 28, 2011 Good to hear that the Lag function is working.Since you want only new item to be displayed, that is if the current row is not equal to previous row.So all you need to do is put the condition for the details band.It should work. Link to comment Share on other sites More sharing options...
jimh_1 Posted July 29, 2011 Author Share Posted July 29, 2011 Thanks for all your help with this, I have now managed to get it all to work correctly... ....Now on with the other issues!! Link to comment Share on other sites More sharing options...
jasperoily Posted July 29, 2011 Share Posted July 29, 2011 You are welcome, All the best for the rest. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now