Jump to content

display or not an image on Page Header


Recommended Posts


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

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

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() !=  0

Let me know whether it works or not.

Link to comment
Share on other sites

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

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

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