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

atsu

Members
  • Posts

    5
  • Joined

  • Last visited

atsu's Achievements

Rookie

Rookie (2/14)

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

Recent Badges

0

Reputation

  1. Hi there, I need to do this in the next 48 hours and it just won't work. somebody please help me out. I am writing an application for a fishing harbour I need to create a quarterly and yearly report from a database such that I'll sort and group records by the date of arrival of the vessel and print the section for every month as attached to the letter. Please help me out because I really don't know how to go about it
  2. I have tried that but it still will not work.. it continues to show the value of the last row as the total
  3. I created a sum variable to calculate the total of of every column at the end of the page. The variable only shows the value of the final value in the result set. when I try to set the Expression class to java.lang.Double, the compiler throws the error: Cannot cast String to Double. Attached is a code and a copy of the file..... Somebody please help me out.......
  4. This is my first time of using this site, how do I read the views and replies. please help me out
  5. I'm trying to call a jasper report in a java application but it gives me the following error.I am using netbeans ide 6.9 and ireport 3.7.3 Below are the errors that I get when I run the code [EL Info]: 2010-08-12 09:06:49.707--ServerSession(12759798)--EclipseLink, version: Eclipse Persistence Services - 2.0.2.v20100323-r6872 [EL Info]: 2010-08-12 09:06:51.111--ServerSession(12759798)--file:/C:/Users/masterelose/Desktop/current/FHMS/src/_FHMSPU login successful Data source : net.sf.jasperreports.engine.data.JRBeanCollectionDataSource@b05236 net.sf.jasperreports.engine.JRException: Error retrieving field value from bean : squid_quantity at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:123) at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getFieldValue(JRAbstractBeanDataSource.java:96) at net.sf.jasperreports.engine.data.JRBeanCollectionDataSource.getFieldValue(JRBeanCollectionDataSource.java:100) at net.sf.jasperreports.engine.fill.JRFillDataset.setOldValues(JRFillDataset.java:823) at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:787) at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1478) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:125) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:942) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:860) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:84) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:605) at com.fhms.reporting.ReportManager.showReport(ReportManager.java:25) at com.fhms.ui.FHMSMainWindow.reportViewerLinkActionPerformed(FHMSMainWindow.java:355) at com.fhms.ui.FHMSMainWindow.access$400(FHMSMainWindow.java:22) at com.fhms.ui.FHMSMainWindow$5.actionPerformed(FHMSMainWindow.java:197) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at org.jdesktop.swingx.JXHyperlink.fireActionPerformed(JXHyperlink.java:244) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6038) at javax.swing.JComponent.processMouseEvent(JComponent.java:3260) at java.awt.Component.processEvent(Component.java:5803) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4410) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) at java.awt.Container.dispatchEventImpl(Container.java:2102) at java.awt.Window.dispatchEventImpl(Window.java:2429) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) Caused by: java.lang.NoSuchMethodException: Unknown property 'squid_quantity' on class 'class com.fhms.details.DailyReturnsDetails' at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1313) at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:762) at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:837) at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:426) at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:111) ... 41 more BUILD SUCCESSFUL (total time: 1 minute 23 seconds) Code:Below is the code of the Report managerpackage com.fhms.reporting;import com.fhms.details.DailyReturnsDetails;import java.io.InputStream;import java.util.Collection;import java.util.Map;import net.sf.jasperreports.engine.JRDataSource;import net.sf.jasperreports.engine.JasperFillManager;import net.sf.jasperreports.engine.JasperPrint;import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;import net.sf.jasperreports.view.JasperViewer;public class ReportManager { private InputStream reportInputStream; private JasperPrint jasperPrint = new JasperPrint(); private JRDataSource reportDataSource; private JasperViewer jasperViewer; public void showReport(Map reportParams, Collection<DailyReturnsDetails> entityJavaBeans, String reportFileName) { try { this.reportInputStream = ReportManager.class.getResourceAsStream(reportFileName); this.reportDataSource = new JRBeanCollectionDataSource(entityJavaBeans); System.out.println("Data source : " + reportDataSource); jasperPrint = JasperFillManager.fillReport(reportInputStream, reportParams, reportDataSource); this.jasperViewer = new JasperViewer(jasperPrint,false); this.jasperViewer.setVisible(true); } catch (Exception e) { e.printStackTrace(); } }}Below is the code that converts the details of the reportpackage com.fhms.reporting;import com.fhms.details.DailyReturnsDetails;import com.fhms.entities.DailyReturns;import java.util.ArrayList;import java.util.List;public class DailyReturnsConverter{ public static List<DailyReturnsDetails> convertToDetails(List<DailyReturns> listOfDailyReturns) { List<DailyReturnsDetails> listOfDailyReturnsDetails = new ArrayList<DailyReturnsDetails>(); for(DailyReturns dailyReturns : listOfDailyReturns) { DailyReturnsDetails dailyReturnsDetails = new DailyReturnsDetails(); dailyReturnsDetails.setDateOfArrival(String.valueOf(dailyReturns.getDateOfArrival())); dailyReturnsDetails.setVessel(dailyReturns.getVessel()); dailyReturnsDetails.setRedfishQuantity(String.valueOf(dailyReturns.getRedfishQuantity())); dailyReturnsDetails.setSquidQuantity(String.valueOf(dailyReturns.getSquidQuantity())); dailyReturnsDetails.setOtherFishesQuantity(String.valueOf(dailyReturns.getOtherFishesQuantity())); dailyReturnsDetails.setNumberOfCrates(String.valueOf(dailyReturns.getNumberOfCrates())); dailyReturnsDetails.setNumberOfKilos(String.valueOf(dailyReturns.getNumberOfKilos())); dailyReturnsDetails.setMetricTonnes(String.valueOf(dailyReturns.getMetricTonnes())); listOfDailyReturnsDetails.add(dailyReturnsDetails); } return listOfDailyReturnsDetails; }}Below is how I call it behind a hyperlink Map parameters = new HashMap(); ReportManager reportManager = new ReportManager(); List<DailyReturns> listOfDailyReturns = FHMSDatastore.getFHMSDatastore().getAllDailyReturns(); List<DailyReturnsDetails> listOfDailyReturnDetails = DailyReturnsConverter.convertToDetails(listOfDailyReturns); reportManager.showReport(parameters, listOfDailyReturnDetails,"/com/fhms/reportfiles/DailyReturnsReports_1.jasper");
×
×
  • Create New...