sk8-86 Posted January 4, 2013 Share Posted January 4, 2013 Select * from MyTable +----------+--------------+| Users | Phone | +----------+--------------+| User1 | iphone3 | | User1 | iphone4 || User1 | iphone5 ||----------+---------------+| User2 | iphone3 || User2 | iphone4 ||----------+---------------|| User3 | iphone5 |+---------+--------------+ How To display an image in iReport ( Page HEADER ) if there is at least one user who's got an 'iphone 5'if No user Has 'iphone 5' => do not display image Thank you. Link to comment Share on other sites More sharing options...
Anuj Dudhakawale Posted January 5, 2013 Share Posted January 5, 2013 1) Use table to show data of Users and phone. In dataset for table write your query Select * from MyTable 2) Write following query in main report Query Text. select count (Phone) as "Phone" from MyTable where Phone = 'iphone5' 3) Take your image at your page header, and check it's property " Print When Expression " In print when expression, write this statement $F{Phone}.intValue() != 0Let me know whether it works or not. Link to comment Share on other sites More sharing options...
sk8-86 Posted January 5, 2013 Author Share Posted January 5, 2013 Hi, thank you for answering, i found a solution by adding subreport etc... my only problem is that the output PDF is on 802% ?? i didnt find any solution, i set page format properties again and again, but PDF still output in 800% Why!!! thank you Link to comment Share on other sites More sharing options...
oesina Posted January 7, 2013 Share Posted January 7, 2013 Anuj, very elegant solution! One definitely can resolve same with subdatasets (queries) and subreports but calculated var is best for sure!SK, guess you are talking about resolution. How big is your page size in iReport? Since PDF pages are always print - A4 or letter by default, it will always stretch a small report. You could leave empty space on the report itself and review all the Stretch properties for your elements. Hope it helps. 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