Jump to content
Changes to the Jaspersoft community edition download ×

Please help printWhenExpression


Recommended Posts

hi friends,

i have generated a csv file.

considering this csv file as a datasource i have to generate two reports based on a particular field.


the field name is id. it has only two types of data.

one is null and the other is 100ADxxxx.




the contents of the csv file is




one report should have


null peter
null mark


second report should have


100AD1234 antony
100AD3265 george


i think i should use printWhenExpression in the jrxml file. But i am not clear how to implement that.

it is an easy task to achieve it in query making use of "like '100AD%'". but i should not do that.


is there any tag like printLikeExpression where by we can find whether the first 5 characters (100ADxxxx)of the data is similar to 100AD so that those data alone can be displayed?


please send me the code or any other good solution.

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Please find that only the field is not getting displayed and other rows are getting displayed when the condition is satisfied.


i need some thing like


select * from csvdatasource where id like '100AD'


so that only the rows in which the field id is like 100AD shall be displayed


now i am getting


100ADxxxx dsfdf
100ADxxxy sddfd
-------- dfdfer
------- ererer


but i need

100ADxxxx dsfdf
100ADxxxy sddfd


only as a seperate report and


null dfdfer
null ererer
Link to comment
Share on other sites

So when I do understand right you want show the fields in turn.


so you should use the PrintWhenExpression:


 new Boolean($F{id} == null) 


for BOTH Fields(id and name)


and check the attribute "removeLineWhenBlank" to true.


So the output will be if the PrintWhenExpression is TRUE:






and if FALSE:





must work! ;)




Post edited by: CBox, at: 2006/09/21 08:29

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