Jump to content

ashish.anant

Members
  • Posts

    6
  • Joined

  • Last visited

ashish.anant'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... If I'm not wrong here, then u want to pass some parameters required for ur query. Anyhow, you can pass the parameters with corresponding values through a java.util.Map. Bellow, I pasted some codes sample, just have a look if it help u by any means... Code: 1 AdminJasperReportResponseWrapper lResponse = new AdminJasperReportResponseWrapper(); 2 Map<String, Object> pMap = pRequest.getReportParams(); 3 String pReportName = pRequest.getReportFile(); 4 if(pMap == null || pMap.isEmpty() || pReportName == null){ 5 lResponse.setErrorMessage("Report Parameters can not be null or empty"«»); 6 return lResponse; 7 } 8 9 try{ 10 setApplicationContext(SpringBeanFinder.m_applicationContext); 11 DataSource ds = (DataSource)SpringBeanFinder.lookUp("dataSource"«»); 12 lCon = ds.getConnection(); 13 14 for (String lFile : getReportFiles()) { 15 if(lFile.equalsIgnoreCase(pReportName)){ 16 Resource lResource = getApplicationContext().getResource(lFile); 17 InputStream lInputStrm = lResource.getInputStream(); 18 jasperPrint = JasperFillManager.fillReport(lInputStrm, pMap, lCon); 19 break; 20 } 21 } 22 }catch(Exception ex) { 23 String connectMsg = "Could not create the report " + ex.getMessage() + " " + ex.getLocalizedMessage(); 24 lResponse.setErrorMessage(connectMsg); 25 } 26 finally { 27 try { 28 lCon.close(); 29 } catch (SQLException e) { 30 LOG.debug("Error occured while closing the connection"«»); 31 } 32 } You can see, I keep some of the required parameters inside the Map, which I'm getting from request object at line-2. And while calling the JasperFillMananger's fillReport() method at line-18, I'm passing this Map as parameter. So, in ur code, in place of passing "null" value, u can send the Map with required parameters. Hope this will help u. Thanks, Ashish
  2. Hello All, I'm using JRHtmlExporter to display my report pages on browser. Now, in case if generated reports are having more than one page, the, as expected, it display all the pages in the same browser all at a time. Pasting here the sample code which I'm using. Code: JRHtmlExporter lHtmlViewer = new JRHtmlExporter(); lHtmlViewer.setParameters(lMap); lHtmlViewer.setParameter(JRHtmlExporterParameter.JASPER_PRINT,lResponse.getJasperPrint()); lHtmlViewer.setParameter(JRHtmlExporterParameter.OUTPUT_WRITER,response.getWriter()); lHtmlViewer.exportReport(); So, is there anyway to put some "Pagination" feature here, so that it display one page at a time on browser with some "next" and "previous" buttons to display another pages? Thanks (in adv) Ashish
  3. Hello Lucian, As per ur guidance, I tried putting dependency in project to JasperReports 2.0.2 (also tried with 2.0.3 & 2.0.4) as below Code: <dependency> <groupId>jasperreports</groupId> <artifactId>jasperreports</artifactId> <scope>compile</scope> <version>2.0.4</version> </dependency> I found while building the project, it downloaded the jar files from "http://repo1.maven.org/maven2/jasperreports/jasperreports/2.0.4/" but even though I'm getting the same compilation error :( Anything else I'm missing here to do? Thanks, Ashish
  4. Hello Lucianc, Thanks for your reply. As I mentioned earlier, I'm using maven and using a plugin "jasperreports-maven-plugin" with version "1.0-beta-1". The plugin load the required jar files from site "http://repository.codehaus.org/org/codehaus/mojo/jasperreports-maven-plugin/1.0-beta-1/". I found the following jars inside my repository. Code: jasperreports-1.2.0.jar jasperreports-1.2.0.jar.sha1 jasperreports-1.2.0.pom jasperreports-1.2.0.pom.sha1 So, using these jars, I'm trying to compile the jrxml files. I didn't get any other plugin which loads the latest jars like jasperreports-2.0.2.jar or others. So, basically, if its because of version of jasperreport, then I need to use some plugin which load me the latest jar of jasperreport. Any idea about any such plugin? Thanks, Ashish
  5. Hello Everybody, I'm using iReports 2.0.3 to create some reports (.jrxml files) & uplaod it on to jasper server. My reports pages have some simple "drill-down" (Links which open up some other report). Now, as per new requirement, I'm compiling the jrxml files (using "jasperreports-maven-plugin" plugin) to embed the compiled file inside the war. But while compilation through maven, I'm getting follwoing error in the files which are having drill down. Code: [iNFO] Compiling report file: reportscustomer-service-reportscatalog-item-reportspurchase_order_by_userName.jrxml org.xml.sax.SAXParseException: Attribute "hyperlinkType" with value "ReportExecution" must have a value from the list "None Reference LocalAnchor Loca lPage RemoteAnchor RemotePage ". at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.validateDTDattribute(XMLDTDValidator.java:1414) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(XMLDTDValidator.java:1333) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:1940) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:764) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1357) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2740) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:645) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at org.apache.commons.digester.Digester.parse(Digester.java:1647) at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:238) at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:225) at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:213) at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:167) at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:151) at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:107) at org.codehaus.mojo.jasperreports.JasperReportsMojo.compile(JasperReportsMojo.java:232) at org.codehaus.mojo.jasperreports.JasperReportsMojo.execute(JasperReportsMojo.java:191) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:447) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126) at org.apache.maven.cli.MavenCli.main(MavenCli.java:282) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) [ERROR] Digester - -Parse Error at line 358 column 159: Attribute "hyperlinkType" with value "ReportExecution" must have a value from the list "None R eference LocalAnchor LocalPage RemoteAnchor RemotePage ". <org.xml.sax.SAXParseException: Attribute "hyperlinkType" with value "ReportExecution" must have a value from the list "None Reference LocalAnchor LocalPage RemoteAnchor RemotePage ".> [iNFO] ------------------------------------------------------------------------ [ERROR] BUILD FAILURE Since for drill down, I'm using <hyperlinkType="ReportExecution">, the compiler doesn't recognizing this "ReportExecution" as a hyperLinkType and its trying to look for anyone of the existing hyperlinkType (eg. None, Reference, LocalAnchor, LocalPage, RemoteAnchor, RemotePage). Can Anyone please suggest me, how to compile files having drill down? Thanks (in adv) Ashish (ashishanant@gmail.com)
  6. Hello All, I'm trying to run the bellow query through Jasper reports. The report ask for two input paramters (startDate and endDate), so, I added two control with the similar name what I'm using in query (pStartDate and pEndDate) of date type. The format I'm using for date is "mm-dd-YYYY". But the problem is, whenever I'm running the same query with some date range directly on mysql console, I'm getting the result properly. Same query with same input is also running and giving me correct result through Open Reports also. But whenever I'm running this query through Jasper Report, I'm getting NOTHING (Saying ... reports data empty). I think, the format of date or something somehow is going wrong here. Can someone pls give me any idea what I'm missing here? I pasted the query below of this mail. I'm using iReport2.0.3 with Jasperserver & MYSQL/ JDK1.6 thanks (in adv) Ashish. (ashishanant@gmail.com) ================== select PO.created as 'Date', PO.purchase_order_id as 'Transaction ID', L.price as 'Transaction Amount', concat(PO.status, '-', ifnull(PO.delivery_status,'')) as 'State', 'paypal' as 'Payment Source', UB.userId as 'Buyer User ID', UB.userEmail as 'Buyer email', PPPVB.email as 'Buyer Paypal ID/Email', URB.buyerRating as 'Buyer Rating', US.userId as 'Seller User ID', US.userEmail as 'Seller email', PPPVS.email as 'Seller Paypal ID/Email', URS.sellerRating as 'Seller Rating', G.gameShortName as Game, UAB.userAvatarName as 'Buyer Avatar Name', UAS.userAvatarName as 'Seller Avatar Name', CI.catalogItemTitle as Item, L.price as Amount from ps_purchase_order PO join ps_listing L on (PO.listing_id = L.listing_id) join useravatar UAB on (PO.avatar_id = UAB.userAvatarId) join ps_purchase_attempt PURCHA on (PURCHA.purchase_order_id = PO.purchase_order_id) join ps_payment_attempt PAB on (PURCHA.payment_attempt_id = PAB.payment_attempt_id) join ps_payment_vehicle PVB on (PVB.payment_vehicle_id = PAB.payment_vehicle_id) join ps_paypal_payment_vehicle PPPVB on (PPPVB.payment_vehicle_id = PVB.payment_vehicle_id) join user UB on (UAB.userId = UB.userId) join useravatar UAS on (L.avatar_id = UAS.userAvatarId) join user US on (UAS.userId = US.userId) join ps_account ACCTS on (US.userId = ACCTS.user_id) join ps_payment_vehicle PVS on (ACCTS.account_id = PVS.account_id) join ps_paypal_payment_vehicle PPPVS on (PPPVS.payment_vehicle_id = PVS.payment_vehicle_id) join catalogitem CI on (L.item_id = CI.catalogItemId) join game G on (CI.gameId = G.gameId) join userrating URB on (UB.userId = URB.userId) join userrating URS on (US.userId = URS.userId) where PO.status in ('PAID', 'INVOICED') and PVS.status = 'ACTIVE' and (date_format(PO.created, '%m-%d-%Y') >= $P{pStartDate}) and (date_format(PO.created, '%m-%d-%Y') <= $P{pEndDate}) group by PO.purchase_order_id order by PO.created desc;
×
×
  • Create New...