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

greenockboy

Members
  • Posts

    32
  • Joined

  • Last visited

greenockboy's Achievements

Contributor

Contributor (5/14)

  • First Post Rare
  • Collaborator Rare
  • Conversation Starter Rare
  • Week One Done
  • One Month Later

Recent Badges

0

Reputation

  1. Hi I've been under the impression, after having read through scores of posts to the forum, that the background colour of a textfield cannot be 'toggled' using a style coupled with a condition or conditions. I have managed to do just this with ease and felt that I should post the solution to the forum should anyone else seek the same. The solution is to ensure that the text field's own property has the background set to the default setting. (The style will be overridded if the text field background is directly set to anything other than default). Then create your style, add as many conditions as you wish with a different background colour for each condition..........then simply add the style to your text field. One point though, any changes you make to a style will not be reflected in the text field until you remove the style from the text field and then re-apply it.(Quirk of ireport?) Hope this helps someone GB - Scotland Post edited by: greenockboy, at: 2008/04/24 09:41
  2. Hi Guys I need to have a report split into two pages. The only way I can do this is by creating a master report together with a subreport. The master report actually supplies all of the values to the subreport. However, I am aware that subreports must retrieve at least one field from a datasource otherwise the subreport cannot be created. Therefore I have been forced to pass the connection to the subreport and add a simple SQL query to the subreport. I would much prefer not to have to use this SQL in the subreport as I do not need the field it returns. I am aware that other datasources can be used instead of the connection but have not yet discovered how to implement them to help in my case. If anyone can help I would be very gratefull. Regards GB
  3. Hi Carlo It won't appear in the drop down, you have to type it in yourself. org.apache.derby.jdbc.EmbeddedDriver
  4. Solution !! As with all these things it was simple. The problem is caused if iReport still has the original tools.jar file in it's library. When an update version of JDK is installed then the tools.jar file must be replaced with the latest one. Hope this helps some people. Regards GB
  5. Hi I discovered the cause of the problem. It is down to the my JDBC URL setting. The format for this should be: jdbc:derby:C:/javadb/database/contact_database Hope this helps someone in the future. Regards George
  6. Hi I am trying to set up a connection to the javadb database. I have created the database via the netbeans IDE and have a simple table. My iReport connection settings are: JDBC Driver - org.apache.derby.jdbc.EmbeddedDriver URL - jdbc:derby://localhost:1527/contact_database I have added derby.jar to the iReport classpath. However when I test the connection I receive the following message: General problem: null Please check username and password. The DBMS is running?! My username and password are correct and I have started the database server. Dose anyone have any ideas
  7. Hi I've spent the last day or so looking into this. The problem is that ireport does not like JRE/JDK 1.5 when a report contains a scriptlet. The report will only compile with JDK version 1.4.2. The problem is with jar file 'rt.jar'. Adding this file from JDK 1.4.2 to the iReport classpath does not work. Copying the file from 1.4.2 into 1.5 is not an option as iReport then won't run at all. I have also tried re-installing JDK 1.5 into another folder, but iReport still finds this later version. So, the only solution to this problem would appear to remove any JDK except for version 1.4.2. However, this is a problem if you are running something like Netbeans 5.5 that requires 1.5 or above......and that is the catch 22 situation. I live in the hope that there must be a way to stop iReport roaming the system looking for the latest version of Java SDK and instead force it to look in only the directory containing JDK 1.4.2. Can any of the guru's give an insight into this? Thanks GB
  8. Hi Some time ago I posted a problem regarding the version of the JDK that developers might be running against. Any reports containing scriptlets were returning errors when attempting to compile. The error message read: ....cannot access java.lang.Object bad class file: C:Program FilesJavajre1.5.0_02librt.jar(java/lang/Object.class) class file has wrong version 49.0, should be 48.0 At my place of work we are using JDK 1.5 but I have found that the problem still persists and I cannot compile reports that rely on a scriptlet within the report. I am using iReport 1.2.7 Is there any work around for this problem? The reason that I ask is that it is not possible for me to return to JDK 1.4.2. Many Thanks GB
  9. Hi I have managed to resolve the problem regarding the creation of pdf files containing no data, despite using a pre-compiled .jasper file created in ireports that did indeed contain data. The problem appears to be related to the using of a JrEmptydataSource object when filling the report. Everywhere I looked I was being told that this was the way to go. However in order to actually fill my report with data I had to use a Connection object instead. For those that will experience the same problem as I did then the code that ultimately worked for me is shown below. Code: JasperReport jasperReport; JasperPrint jasperPrint; try { Class.forName("ca.edbc.jdbc.EdbcDriver"«»); Connection conn = DriverManager.getConnection("jdbc:edbc://myDatabase", "myname","myPassword"«»); jasperPrint = JasperFillManager.fillReport("C:/Untitled_report_11.jasper", new HashMap(), conn); JRExporter exporter = new net.sf.jasperreports.engine.export.JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,"C:/example.pdf"«»); exporter.exportReport(); } catch (Exception e) { e.printStackTrace(); } Anyway, good luck all and bye for now. GB
  10. Hi I have managed to resolve the problem regarding the creation of pdf files containing no data, despite using a pre-compiled .jasper file created in ireports that did indeed contain data. The problem appears to be related to the using of a JrEmptydataSource object when filling the report. Everywhere I looked I was being told that this was the way to go. However in order to actually fill my report with data I had to use a Connection object instead. For those that will experience the same problem as I did then the code that ultimately worked for me is shown below. Code: JasperReport jasperReport; JasperPrint jasperPrint; try { Class.forName("ca.edbc.jdbc.EdbcDriver"«»); Connection conn = DriverManager.getConnection("jdbc:edbc://myDatabase", "myname","myPassword"«»); jasperPrint = JasperFillManager.fillReport("C:/Untitled_report_11.jasper", new HashMap(), conn); JRExporter exporter = new net.sf.jasperreports.engine.export.JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,"C:/example.pdf"«»); exporter.exportReport(); } catch (Exception e) { e.printStackTrace(); } Anyway, good luck all and bye for now. GB
  11. Hi I posted a question recently regarding the generation of reports via a java application. My problem is that everytime I try to create a pdf file from my .jasper file then it generates the file but shows no data....only nulls, the report works fine when run from ireport. I have searched the forum on this one and can find no reason for this. Unfortunately I cannot access the zip files containing code examples due to restrictions on my PC. I am sure that it has something to do with the datasource, but alas cannot work out what. Here is my simple code: Code: JasperReport jasperReport; JasperPrint jasperPrint; try { jasperPrint = JasperFillManager.fillReport("C:/Untitled_report_11.jasper", new HashMap(), new JREmptyDataSource()); JRExporter exporter = new net.sf.jasperreports.engine.export.JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,"Y:/my IReport Stuff/netbeans.pdf"«»); exporter.exportReport(); } catch (JRException e) { e.printStackTrace(); } If anyone can see any problem in the code I would appreciate some help. Even if the code looks OK at least it will be something. Many Thanks GB
  12. Hi I've created a simple report in ireport that uses an SQL statement as the datasource. The report has been compiled and displayed in ireport. However, I cannot seem to invoke the report from a simple java application and I can't work out why. Here is the code in my very simple app: Code:import net.sf.jasperreports.engine.*; import net.sf.jasperreports.engine.export.*; import java.util.*; public class JasperReportsIntro { public static void main(String[] args) { JasperReport jasperReport; JasperPrint jasperPrint; try { jasperReport = JasperCompileManager.compileReport( "C:/my_ireports/my_report.jrxml"«»); jasperPrint = JasperFillManager.fillReport( jasperReport, new HashMap(), new JREmptyDataSource()); JasperExportManager.exportReportToPdfFile( jasperPrint, "reports/simple_report.pdf"«»); JasperPrintManager.printPages(myReport, 4, 10, true); } catch (JRException e) { e.printStackTrace(); } } } I have also tried substituting the jrxml file for the jasper file, but still no good. Any help would be greatly appreciated. Thanks GB
  13. Hi I recently psted a question regarding calculating variable totals using ireport. I have looked into this problem and have come across an anomaly. I recently managed to retrieve integer data using a scriptlet method and assigned the values to a variable. I then created another variable and set it's calculation type to Sum and it's expression to the first variable......ireport successfully displayed the total. However, when I tried to retrieve and display values for a second column from the same table (using the same scriptlet method) I ran into problems. ireport at first would only display the first value totals. When I tried to altert the method code and swap each of the statements in order to try to work out what was happening the ireport refused to work out any totals. When I reset my code to match the original then ireport would still not display the totals that it previously had, even with everything exactly the same. If anyone has had similar experiences and can shed some light then I would be very gratefull. Incidently to display field values that have come from a scriptlet method then place the method call in the afterDetailEval event. To display group totals for the variable then place the same call in the beforeDetailEval() event. At least it worked for me...when it did work. Post edited by: greenockboy, at: 2007/02/21 11:30
  14. Hi I have a report that retrieves records based on a join between two tables. These records are crossed referenced with records from a third table and a status value retrieved from the third table using a scriptlet method. The status value is then assigned to a variable I have created in ireport. I would like to know which record from each group has the highest status value but without success. I have tried creating another variable and setting the calculation type to highest out but it appears to be impossible to do this with a variable as opposed to a field value. Any help would be very much appreciated. Thanks GB
×
×
  • Create New...