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

tobgay

Members
  • Posts

    2
  • Joined

  • Last visited

tobgay's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. i AM using netbeans 6.0.1 and have installed ireports pluging.. i am created a report template and in netbeans 6.0.1 and it works fine..but how can i display the report in my java applivation.. thanks Code:my code isConnection conn = null;try {String reportName = "report1.jasper";InputStream fis = this.getClass().getClassLoader().getResourceAsStream(reportName);JasperPrint print = JasperFillManager.fillReport(fis, new HashMap(), conn);JasperViewer jv = new JasperViewer(print);jv.setVisible(true);} catch (Exception ex){ex.printStackTrace();} finally {if (conn != null)try {conn.close(); } catch (Exception ex) {}}and it doesnot work.. can any one please help me
  2. yeah... use ireports pluging.. in nebeans...create a report and then iReport NB - Getting Started This information refers to iReport NB-0.9.0, and the screens are taken by the standalone version based on the NetBeans Rich Client Platform. This information should be applicable to future versions of iReport NB (3.1.1 included). 1. Installation 1.a iReport on Windows Download the windows installer (iReport-nb-x.y.z-windows-installer.exe) and run it. Find iReport in the start menu (All Programs->Jaspersoft->iReport-nb-x.y.z->iReport-nb-x.y.z) 1.b iReport on Linux Download iReport-nb-x.y.z.tar.gz, uncompress it and run the shell script /bin/ireport 1.c iReport on Mac OSX iReport does not come with a Mac distribution, but you can use the .tar.gz distribution and run iReport.sh (in the bin direcotry). If someone is interested in creating a Mac version of iReport (as Mac application), please send me an email (giulio at Jaspersoft dot com). 2. Basic configuration iReport users need to connect to a JDBC database. iReport supports other connections types. NetBeans (the skeleton of this new version of iReport) comes with database drivers pre-installed: MySQL, Postgres, JavaDB and JDBC-ODBC bridge. Use a native JDBC driver instead of the JDBC-ODBC bridge. To create a database connection using these drivers, use the Service panel in NetBeans. First, configure a new iReport connection to create and run a SQL query report. When a report is executed, it requires a connection or data source from which data to print is acquired. To use an SQL query, we need a JDBC connection. First of all, create a JDBC connection in NetBeans. (fig. 1) Open the Services panel, Windows->Services (fig 1), (fig. 2) add a new connection. To specify a driver that is not in the list (i.e., Oracle); add the driver jar by clicking on Drivers and selecting the popup menu New Driver. (fig 2.) (fig. 3) Configure the connection (you need the database URL, username and password (fig 3.) (fig. 4) Now you should get an entry like in (fig 4.) (fig. 5) To use this JDBC connection with a report, "wrap" the JDBC connection with an iReport connection. Click the data source button and click New to create a new connection.(fig 5) (fig. 6) Select NetBeans Database JDBC connection (fig. 6) (fig. 7) select your connection from the drop down in the following step and set the name for your connection. (fig. 7) Now, create the report. 3. Using the wizard With a configured JDBC connection, create a report using the Report Wizard. Select File->Report wizard to run the wizard. In the IDE plugin find the wizard in All templates->Reports->Report Wizard. After setting the new report location, select the connection/datasource to use with the wizard (JDBC connection). Specify a report query to select data to print; iReport will discover available fields: pick fields to add to the report. The grouping step groups data by one or more fields; generating a group header and footer (i.e., you may want aggregate a set of persons by county, or city). The order by clause in the SQL query when using the wizard is required to correctly generate the final report (even if JR supports in memory sorting). The wizard provides a limited way to create groups, you can create them at any time when designing a report, and use sophisticated expressions to aggregate data records. The final step is the choice of layout. In this version of iReport only the classic layout is available (for both tabular and columnar reports type). The available layouts are taken by a special directory in the virtual file system of NetBeans (/templates/columnar and /templates/tabular) meaning that other plugins, and other users, will be able to add custom layouts. At the end of the wizard is the design. The report in figure 8 (fig 8) has been created from a SugarCRM database using the query:select * from accounts order by billling_address_country and contains just a group for the country. (fig 8) 4. Running the report Compile the design template (JRXML) in a jasper file and execute against the selected data source (the JDBC connection). The report is first defined in a template, an xml file with .jrxml extension. This file is compiled in a serialized class stored in a file with the .jasper extension. When you run a report from a java application (web or desktop), load the jasper file and using a data source or a connection through the JasperReports API generate a meta print (a JRPrint object) using one of the JasperReports JasperFillManager.fillReport methods. Second, export the JRPrint in a final format, PDF, HTML. XLS, etc. Sometimes this intermediate step (creation of the JRPrint object) is hidden by the JasperReports API. The compilation process creates a jasper file, if the template has inconsistency, or if there is a syntax error in one of the report expressions, an error appears in the iReport console. To run the report, press Preview in the editor toolbar. The report is shown in the preview tab. Thanks..hope this will help
×
×
  • Create New...