technicalguy Posted April 6, 2011 Share Posted April 6, 2011 HiI am new to jReports and I am trying to write an expression. The underlying field is INT and it stores 1 or 0 I would like to display on the reoprt TRUE if the value is 1 and FALSE if the value is 0.How may this be done please.IvanPost Edited by icarey at 04/06/2011 11:58 Link to comment Share on other sites More sharing options...
dgangstaz Posted April 6, 2011 Share Posted April 6, 2011 Try this:$F{int_field}==1?'TRUE': 'FALSE' Link to comment Share on other sites More sharing options...
technicalguy Posted April 7, 2011 Author Share Posted April 7, 2011 Thank you for your replyI tried this and the field goes blank Link to comment Share on other sites More sharing options...
dgangstaz Posted April 7, 2011 Share Posted April 7, 2011 http://books.google.com/books?id=GeLCEnT1VpMC&pg=PA22&lpg=PA22&dq=ireports+field+groovy&source=bl&ots=acR5wMk4y0&sig=yFZrJQnPWmGRa1UzOfTR2oP6JMQ&hl=ro&ei=ELGdTbM_jd2yBovtjb0E&sa=X&oi=book_result&ct=result&resnum=3&ved=0CCgQ6AEwAg#v=onepage&q&f=false Link to comment Share on other sites More sharing options...
kalvarez Posted April 7, 2011 Share Posted April 7, 2011 Hi!!The field is an integer, and you want to show a string, so you have to set the expression class as java.lang.string$F{int_field}==1?'TRUE': 'FALSE' Link to comment Share on other sites More sharing options...
dgangstaz Posted April 7, 2011 Share Posted April 7, 2011 Indeed, I forgot to mention this Link to comment Share on other sites More sharing options...
technicalguy Posted April 9, 2011 Author Share Posted April 9, 2011 Thans everyone.I can now display this on the report. I am using the XML generated file and parse it to phpjasperxml which then uses fpdf to produce a pdf of the report. When using an expression to dipslay TRUE FALSE the field appears blank on the pdf. If i just leave the feild as is it displays 1 or 0. I would like to be able to display in the pdf TRUE or FALSE.I have been able to display on the pdf as I require by placing an IF in the SQL select statmentIF(`WorkRelated` = 1, 'TRUE', 'FALSE')IvanPost Edited by icarey at 04/09/2011 03:06 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