javi_123 Posted June 25, 2009 Share Posted June 25, 2009 Hi All,Is it possible to use a insert sql statement in the expression editor of iReports??Many ThanksJavi Link to comment Share on other sites More sharing options...
svenn Posted June 25, 2009 Share Posted June 25, 2009 Never tried it but I doubt it does. You could call a Scriplet do an insert in there. Link to comment Share on other sites More sharing options...
javi_123 Posted June 25, 2009 Author Share Posted June 25, 2009 how do you use scriplet through iReports?? i havnt done it before, could you please provide an example?? I need to add a license agreement page for out external customers. As soon as the user logs in, the license agreement page should appear which will contain information about the terms and conditions. If the user agrees with the terms and conditions, then the link should direct the user to the home page. If the user disagree, then the link should logout the user from the session. I have created a report unit from iReports and have changed the following URL in jasperserver-servlet-pro.xml source file: ROLE_USER|redirect:/flow.html?_flowId=viewReportFlow&reportUnit=/public/SRA/View/LicensePage When a user logs in, license page appears instead of home page. In the report unit I have added two links: 1: Agree 2: Disagree Both the links work accordingly. When a user clicks on Agree link, it then redirects the user to home page and if user clicks on Disagree link, it logs the user out. Now, if the user has agreed with the terms and conditions, the license page should not appear second time which it does at the moment. In the report query I have tried to use an insert statement but I think iReports doesn¿t allow the insert statement in the report query. All I need to know is how can we redirect the user to home page once the user has agreed with terms and conditions?? WE are using iReports V3.5.2 and JasperServer V3.5.1 on SUSE Linux Enterprise Server Version 10, Service pack 2 with Mysql 5. If there is any other alternative method to do it, please let me know about that Many Thanks javi Link to comment Share on other sites More sharing options...
svenn Posted June 25, 2009 Share Posted June 25, 2009 Well you wouldn't want to do this with Scriplets. It sound like you need some sort of wrapper around the Jasper Server. I would try asking the question in the Jasper Server forum. Link to comment Share on other sites More sharing options...
javi_123 Posted June 26, 2009 Author Share Posted June 26, 2009 I have already posed it on jasperserver forums but i havnt received any kind of reply from the jasperserver guru's. I think they randomly choose the threads to reply on, otherwise they would have definitely replied to my thread.Have you added this kind of functionality before? RegardsJavi Link to comment Share on other sites More sharing options...
svenn Posted June 26, 2009 Share Posted June 26, 2009 No I haven't., in fact we don't use the Jasper Server. We call a Servlet that we created to run our reports. Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted June 29, 2009 Share Posted June 29, 2009 Not sure what you want to do, but a trick to execute code in iReport is to put an element (i.e. in the title) with a print when expression like:com.mycompany.MyClass.myMethod()myMethod is a static public method of com.mycompany.MyClass which is a class that must be in the classpath. The method should return Boolean. FALSE so the printWhen expression result false and the element is not printed. Inside the method you can put all the code you want.An example:public class MyClass { public static Boolean myMethod(java.sql.Connection c){ .... code to insert a record using the connection .... return Boolean.FALSE;}} the print when expression should be something like:com.mycompany.MyClass.myMethod($P{REPORT_CONNECTION}) Giulio 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