Win a copy of Head First Android this week in the Android forum!

yann luppo

+ Follow
since Oct 29, 2008
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by yann luppo

Hi lekshmi,

Replying to a post marked as resolved is probably not going to get you a whole lot of responses.... I would suggest you copy your reply and create your own post so you can get more help.

I haven't used the Jasper Action class and therefore can hardly help you with that.

Wishing you good luck,
Ok so I resolved how to make a dynamic query in the jrxml itself and within the querystring tag.... It just took me a few days so I'm going to share hoping it will save other's people time.

The solution using the variable I was trying earlier and explained above isn't far from the actual solution. Except instead of using variables, you need to use a parameter.

First declare a parameter that will help trip the right logic:

Then the parameter that contains the actual logic (please note the attribute :

Finally your querystring can use that last parameter however you need it:

Please note the use of $P!{} instead of the plain $P{}. The exclamation point is important to make sure that the content of the parameter is one of the first thing to be evaluated.

Using that same logic you can also modify only pieces of your SQL if the queries are close enough.

Hope that will save time for some people.


Darya Akbari wrote:
You can have one template or better .jrxml file. Go and create that one report with your iReport visual design tool. For each type of report create a group with iReport.

Hi Darya,

Thank you for your reply. The 2 queries I have are slightly different, so I still would need to have 2 queries defined in the JRXML, one for each group... I'm not sure how to do that.
If that can be solved then I can see how to display only one group with a Java expression, iReport made that easy enough to do, but I seem to be allowed to have only one querystring...
I'm hitting a dead end on this. The variable solution I was talking about earlier doesn't seem to work no matter what I do.

I'd either need to inject the query based on an input parameter or change a couple of things in the query based again on an input param, because the 2 queries will actually be very similar...

Any Jasper super Guru out there with that'd have an idea on how to approach this?

yann luppo wrote:Just found out about Scriptlets. I'm gonna dig in that direction, just in case someday another Jasper Report beginner like me ever finds that post.

After reading about scriptlets it seems like it could be the solution but I got side tracked thinking there might be an easier way to do that. Namely using a variable to store the sql to be executed based on an input parameter parsed in a java expression.
Here it is illustrated:

That's my querystring pointing to a variable, which is declared as such:

I also have declared the parameter "reportType" right before the querystring like this:

But this method doesn't seem to work properly, I get an error message:

Error filling print... Error executing SQL statement for : report_summary
net.sf.jasperreports.engine.JRException: Error executing SQL statement for : report_summary      at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(      at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(      at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(      at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(      at net.sf.jasperreports.engine.fill.JRFiller.fillReport(      at net.sf.jasperreports.engine.JasperFillManager.fillReport(      at net.sf.jasperreports.engine.JasperFillManager.fillReport(      at      at org.openide.util.RequestProcessor$      at org.openide.util.RequestProcessor$  Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "$"      at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(      at org.postgresql.core.v3.QueryExecutorImpl.processResults(      at org.postgresql.core.v3.QueryExecutorImpl.execute(      at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(      at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(      at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(      at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(      ... 11 more 
Print not filled. Try to use an EmptyDataSource...

Could anyone point me in the right direction in how to implement mulitple queryies in one jrxml template please?

Thank you.
Just found out about Scriptlets. I'm gonna dig in that direction, just in case someday another Jasper Report beginner like me ever finds that post.
Hi everyone,

I am currently working on a reporting feature at work that looks like it could be improved. There are 4 reports running on Jasper and made with iReport. Those 4 reports are very similar, in fact they use the same data to show different type of information.

One is a daily detailed report, the other is a daily summary report, then there is a monthly detailed report and finally a monthly summary report. By now you might have already guessed where I'm going with that... Being new to iReport and Jasper, I was wondering if I could have only one template and work the slight differences between each report with some conditions based on some additional input parameters? Or any other way.

Anyone who's ever done that or something similar with those tools by any chance?

Rosco you da man! That looks exactly like what I need. I'm gonna give that a shot today. Thanks man!

Rosco Duncan wrote:I had to do this recently also, but I dont have the code at hand. Will see if I can dig it up tomorrow

Essentially you are correct about setting the 'contentType' on the HttpServletResponse. I believe you would need to do this on one of your controller methods. Which version of Spring are you using?


Thanks for your reply Rosco, our POM points to Spring MVC 2.5.4.
Hi everyone,

I'm currently working on a Spring MVC app and I was wondering how I could generate files in memory and make those files downloadable for the end user?
I've seen solutions setting the contentType to "application/octetstream" but I don't know how and where I would do that in an MVC app... Or maybe I should reroute those urls generating files dynamically to a regular request handler instead of a controller?

A little bit of "best practice" advice would be greatly appreciated.

Thank you

Vin Maxie wrote:... I get the following error message: 'The function getRecId must be used with a prefix when a default namespace is not specified'

Any luck with that? I'm getting the same error message?
12 years ago
Ok so I figured out the login interception business using a SecurityListener class implementing a ApplicationListener and checking the type of the ApplicationEvent passed in like this:


Now my next problem is that there I can't seem to find a class representing a logout event. At this point I'm starting to wonder if logging out triggers an application event that would go through my securitylistener at all?

Any idea?

I just started on a project that's using Spring Security and I would like to intercept successful login and logout events to do some work at those point of times.
Any idea what's the best way to achieve that?

Any indication as to where I need to put my plumbing code to run the logic required during those events (success login, logout) would pretty much be all I need.

Hi everyone,

I've been looking all around the Internet this morning trying to find a way to append the hostname to the log filename in the log4j.xml.
I've tried to do it in code, but I'm new to that project and it seems like wherever I put the code to change that property it's happening too late or breaking the logger or the appender.

I found some hope at some point when I figured out I could use system properties and other predefined variables in the config xml like that:

Except I can't seem to find a variable that's actually returning the name or the IP address of the host. Neither in the default Java System properties or in the Maven properties for that matter. Since we're using Maven, I actually saw they have some default properties I could use, but none that helps in this case.

Anyone would know how to approach that issue?


Someone told me there a was a dwr tool class to unmarshall the inputstream of a request. I can't seem to find such a class, anyone out there who's ever heard of that or done it?

12 years ago