Kannan_S Posted September 20, 2006 Share Posted September 20, 2006 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. i.e., the contents of the csv file is null,peternull,mark100AD1234,antony100AD3265,george one report should have null peternull mark second report should have 100AD1234 antony100AD3265 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 More sharing options...
rcracel Posted September 20, 2006 Share Posted September 20, 2006 Hi Kannan, why not set it to print whenever the field is not null? RC Link to comment Share on other sites More sharing options...
C-Box Posted September 20, 2006 Share Posted September 20, 2006 Here a simple Sample for your PrintWhenExpression: Code:new Boolean($F{MyField}.startsWith("100AD"«»)) ;) hthC-Box Link to comment Share on other sites More sharing options...
Kannan_S Posted September 21, 2006 Author Share Posted September 21, 2006 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 dsfdf100ADxxxy sddfd-------- dfdfer------- ererer but i need100ADxxxx dsfdf100ADxxxy sddfd only as a seperate report and null dfdfernull ererer Link to comment Share on other sites More sharing options...
C-Box Posted September 21, 2006 Share Posted September 21, 2006 So when I do understand right you want show the fields in turn. so you should use the PrintWhenExpression: Code: 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: null,peternull,mark and if FALSE: 100AD1234,antony100AD3265,george must work! ;) hthC-BoxPost edited by: CBox, at: 2006/09/21 08:29 Link to comment Share on other sites More sharing options...
lucianc Posted September 21, 2006 Share Posted September 21, 2006 If you set the printWhenExpression for a text field, then of course that the expression will only apply to the text field. You should either set the printWhenExpression for the detail band or, if you are using JR >= 1.2.5, use the report filterExpression. HTH,Lucian 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