Jump to content
We've recently updated our Privacy Statement, available here ×

rob.mccarthy

Members
  • Posts

    15
  • Joined

  • Last visited

rob.mccarthy's Achievements

Apprentice

Apprentice (3/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Collaborator Rare

Recent Badges

0

Reputation

  1. I ended up modifying the database query after. This way the report is left unchanged and the sql query modifications resulted in no noticable slowdown in running. If anyone's curious, what I did was take my original query result set (we'll refer to this as salesdata) and dump it to 2 temporary tables. I think do a join between these two tables, one I group/summarize by department, the other by location. This is the resultset I send to the report.
  2. I have an existing sales report that groups/sorts alphabetically (by the database query) based on things like department/category/location. One of the pieces of information displayed in the report is a profit calcuation (both % and $ amounts). I have been asked to allow this report to sort by this calculated account. So say I run a report for all deparments in the company by location, I would get something like this (sorted by Group Name and then by location) CHILDRENS Loc1 Loc2 Totals for Children's LADIES Loc1 Loc2 Totals for Ladies MENS Loc1 Loc2 Totals for Mens Instead of sorting by the group name they would like to sort by which department was more profitable...this order is not known ahead of time because it is a calculation by totalling each locations amount for that department first and showing it in the footer totals area. So the report will display exactly the same information just in a different order. Is there any way for JasperReports to somehow do a sort after based on the summary in the group footer for the profit amount? The query on the database side of things runs very quickly now so I was hoping I would not have to touch it. If I did I'd have to somehow do an additional subquery to total the profile by group, and join to it to get the order...not very pretty. Any thoughts?
  3. I need to integrate a custom applet to be launced within the JasperServer interface. I want to ensure that the user is properly authenticated and the session is active when the applet is launched. Is there anything stored in the session of the webapp that I can get within the applet to verify the session is active and authenticated? Thanks, Rob
  4. Thanks for your response Matt. What I'm thinking I'd like to do is launch and an applet from within jasperserver interface that allows for advanced search/selecting of items, vendors, etc. I'm not really sure how I'll integrate it though. How can I pass the datasource from jasperserver to the applet for database calls. Also I'm not sure how I'd handle the parameter value selection from the applet. I guess a simple copy/paste of a string of values separated by commas might do (using a String parameter in jasperserver), and then parse the parameter set in the report. Ideally I'd like to pass a List object from the applet to the parameters page of jasperserver to be included when launching the report. Any of this possible?
  5. I have a sales report which can be filtered by a number of parameters such as ITEM, VENDOR or DEPARTMENT. I have succussfuly created input controls for the parameters that returns the list of that type from our database but the problem is with the size of the list. Displaying a list of all items or all vendors is just too long and inefficient, especially if both lists are displayed at one time. We have hundreds of vendors and thousands of items that can be chosen. Is there anyway I can handle these types of parameters, such as having a custom jsp page that allows a user to search for the item(s) or vendor(s) they want and have these fill in the parameter fields for the report? Any other ideas how I can effectively handle these parameters? Thanks, Rob
  6. Just wondering if there's a gui application out there for launching jasper reports. I know of jasperserver which is web based but the systems I am deploying these on I don't want to add any additional services. I don't want the user to be able to see/modify the report design (such as iReport). All requirements are an interface to choose the report, prompt and enter the report parameters and finally execute and display the report. They systems are running XP btw. Thanks, Rob
  7. Lucian, your suggestion of using the JRMapCollection worked perfectly. I used the scriplet to keep running totals of the fields needed, passed the Collection of Maps to the subreport and it worked flawlessly. Thanks for your help!
  8. Thanks for your reply. I was actually thinking that something along the lines of what you proposed may be possible, though I have never used a data source other than JDBC connection in any of the reports I have designed to date. From poking around on the forum trying to figure out how to create a JRMapCollectionDataSource, I figure it is constructed of an ArrayList (to provide an ordered list of maps) and each member of the list is a Map of Key (column name) Data (column value) pairing. Each map would be a "record" from the datasource. Is my understanding correct? If so I don't forsee too much trouble implementing such a solution and in my mind better than executing a query twice, especially in a case where the query returns a lot of data. Thanks, Rob Post Edited by Rob McCarthy at 04/14/09 12:09
  9. Here's my dilema. I have a sales report this is has an outer group Category and an inner group Location, giving me totals by location for each category. What I also need is in the summary band at the end of the report to have final totals for all categories by location ...so the design would look something like this ... Category A - Header Loc1 Loc2 Category A - Footer . . . Totals (All Categories) Loc 1 Loc 2 Totals - Footer I can't see anyway of doing this. All I could come up with is to get running totals for each location is a scriptlet class that would contain variables (possibly in a HashMap where location is the key), updated at each record. The problem with this is how to display it in the summary band since I won't know the number of locations the report contains until runtime. The other option I came up with is to place a subreport in the summary band that is essential the same report but there would be a dummy outter group with an inner location group. My issue with this is efficiency. The same query will have to be execute twice for the same report - that doesn't seem too intelligent. Anyone have any ideas how to solve this? Thanks, Rob
  10. I figured out a solution. Using iReport i set the item foooter sum variable INCREMENT type to group, and the group to item.
  11. My report is arranged into two groups, item and location, with location being the inner most group. Item Header Location 1 Location 2 Location 3 Item Footer. In the location footers I display a total which is calculated on the record details, but is not just a running sum. In the item footer I need to display a sum of that variable from each location footer. I tried creating a SUM on the variable needed, with reset on Item and when I place this variable in the Item footer I have the evaluation time set to location. It doesn't give me the right sum. How can I tell the report to sum just the final value in each location footer. I have tried other evaluation times for the variable, giving different results, but none correct. Any help would be appreciated. It seems like it should be so simple but I've been scratching my head over this one for a while. Thanks, Rob
  12. I'm launch reports via JSP but I get some strange behaviour that is only happening whening exporting as PDF in Firefox. If I launch a report (which spawns a new window) and leave that report open and then launch a different report, the new window will display the previous report (or first report if I launch several more reports). The correct report is created and filled properly, this seems to be just a display time thing (as it works in both IE and Chrome, and works if I export as other formats such as Excel or HTML with Firefox). Anyone have any ideas? Ater the report is export I flush and close the output stream. See the code below. Code:File reportFile = new File(application.getRealPath("/reports/" + session.getAttribute("REPORT") + ".jasper")); System.out.println(reportFile.getPath()); if (!reportFile.exists()) throw new JRRuntimeException("File " + filename + ".japser not found. The report design must be compiled first."); JasperReport jasperReport = (JasperReport) JRLoader.loadObject(reportFile.getPath()); JasperPrint jasperPrint = null; try { jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn); } catch (net.sf.jasperreports.engine.JRException e) { System.out.println(e.getMessage()); e.printStackTrace(); } OutputStream outputStream = response.getOutputStream(); JRExporter exporter = null; if ("pdf".equalsIgnoreCase(reporttype)) { response.setContentType("application/pdf"); exporter = new JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, outputStream); } else if ("rtf".equalsIgnoreCase(reporttype)) { response.setContentType("application/rtf"); response.setHeader("Content-Disposition", "inline; filename="file.rtf""); exporter = new JRRtfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, outputStream); } else if ("html".equalsIgnoreCase(reporttype)) { session.setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrint); exporter = new JRHtmlExporter(); exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "./servlet/ImageServlet?image="); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, outputStream); } else if ("xls".equalsIgnoreCase(reporttype)) { response.setContentType("application/xls"); response.setHeader("Content-Disposition", "inline; filename="file.xls""); exporter = new JRXlsExporter(); exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, outputStream); } else if ("csv".equalsIgnoreCase(reporttype)) { response.setContentType("application/csv"); response.setHeader("Content-Disposition", "inline; filename=""+ session.getAttribute("report") + """); exporter = new JRCsvExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, outputStream); }
  13. Thanks for your response but I figured out my problem after. I had some issues with some of the variables not setting properly. Since the report never complained about any null variables and never attempted to execute the query I overlooked them as a possible cause, I guess I just assumed the report would throw an error or something if it attempted to use an invalid parameter. Anyways, all is well!
  14. I forgot to mention I'm running Tomcat 6.0.16 and Java JRE 1.6.0_07 and JasperReports 3.0 I can launch the report directly in java with no problems (using same JRE).
  15. I'm lauching a report via JSP page and everything seems to be working but when the report opens it hasn't been filled, i'm seeing static text only. Not even variables that display information such as creation time are displaying, which are not dependent on any report parameters or database connection. Here's the code snippet that fills the report, JasperPrint jasperPrint = null; try { jasperPrint = JasperFillManager.fillReport(reportFileName, parameters, conn); } catch(net.sf.jasperreports.engine.JRException e) { e.printStackTrace(); } I have verified on the mysql database that the report query is never executed, but I have test the report connection just before passing it to the JasperFillManager and it is active and able to retrieve data from the database. I have also tested the parameters Map and they are filled under the correct names. No errors/exceptions are thrown. If kill the database before JasperFillManager is launched I get an exception thrown so it has to be checking the connection. It is definitely finding the .jasper report file since it loads the static text, and if I alter the filename it throws an error that the file cannot be found. I'm stumped, any ideas? Thanks, Rob
×
×
  • Create New...