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

aditya_gupta

Members
  • Posts

    24
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by aditya_gupta

  1. Hi All, Is any one know how to run the jasper reports on PDA device. What changes I have to do in web application codign so that it will be run on PDA. Is I need to follow any special API to run the reports on PDA. Please try to solve me problem as early as possible.. Thanks Aditya Post edited by: aditya_gupta, at: 2007/10/04 05:45
  2. Hi, First let you know that I am using jasper file in web appliaction and I have checked the path of both (image and jasper file). It is fine. The image is coming when I am providing the relative path in ireport 1.3.0 but when I run the template in ireport as a pdf , the image is displayed in pdf because I have set the classpath of iReport to the image directory. But when I am using this compiled template file(jasper file) in web application, the image is not there in pdf,rtf and xls format. I am using the same method for template which have scriptlets jar file. i.e. Adding path of jar file to ireport classpath and my template file is another path. So in web application i just add jar files as a library and use that jasper file. Its working fine there but for images it is not working. For example, the path for template and image which is used in web application(using netbeans) is, Image path: D:/MyKnoahsARK 2.0/Report/web/config/knoahsoft/client/resource/image/playUp.jpg Template jasper path: D:/MyKnoahsARK 2.0/Report/web/config/knoahsoft/client/report/jasper/voicesession.jasper I think the problem lies only with the path. Do you know how to contact Tedord, forum administrator. He may solve this issue. Thanks Aditya G Post edited by: aditya_gupta, at: 2007/07/06 12:46
  3. Hi, Thanks for your reply. I have checked the both jrxml files,it is not working. I have already tried with two backslashes but the image didnt appear. Any other solution. I am totally in no where land. Do you require any other file or code snippet? please let me know. Aditya
  4. Hi, Are you using internal scriptlet editor or external scriptlet class? If you are using internal scriptlet editor then you dont have to change the name of clas. It is taken by the ireport by default. see if you go to scriptlet editor, you see this type of code, import net.sf.jasperreports.engine.*; public class <ScriptletClassName> extends it.businesslogic.ireport.IReportScriptlet { /** Creates a new instance of JRIreportDefaultScriptlet */ public <ScriptletClassName>() { } } So in this code <scriptletclassname> is automatically set at compile time by the ireport, you dont have to change it. If you are using external scriptlrt class , then choose option ' use this scriptlet class' from report properties option in edit menu and provide the fully classified claas path to text box below to 'use this scriptlet class' option. The class should be added in ireport classpath. Goto option menu and then select classpath. I think this may the solution to your problem. Aditya
  5. Hi, It is very simple. You put ur arraylist in a class. Here is a sample code. public class Test { public static java.util.ArrayList generateCollection() { java.util.ArrayList list = new java.util.ArrayList(); list.add(20); list.add(34); list.add(56); return list; } } Put this clas file in the class path of ireport. for this goto option menu -> classpath and select Add folder and provide the path of your class file and save classpath . after all these, Goto Data -> Connections / Datasources -> new. The parameters for the datasource configuration will be: Name: TestFactoryDataSource(user defined) Type of Datasource : JavaBean set Datasource class: Test (name of fully classified classpath which is having collection) Method to call: name of method in class Return type: Collection of JavaBean and then Test the connection. After succesful connection, save it. Go to report query section, select javabean data source tab and type the class name and click read attributes. I think this will help you Aditya
  6. Hi, It is very simple. You put ur arraylist in a class. Here is a sample code. public class Test { public static java.util.ArrayList generateCollection() { java.util.ArrayList list = new java.util.ArrayList(); list.add(20); list.add(34); list.add(56); return list; } } Put this clas file in the class path of ireport. for this goto option menu -> classpath and select Add folder and provide the path of your class file and save classpath . after all these, Goto Data -> Connections / Datasources -> new. The parameters for the datasource configuration will be: Name: TestFactoryDataSource(user defined) Type of Datasource : JavaBean set Datasource class: Test (name of fully classified classpath which is having collection) Method to call: name of method in class Return type: Collection of JavaBean and then Test the connection. After succesful connection, save it. Go to report query section, select javabean data source tab and type the class name and click read attributes. I think this will help you Aditya
  7. Hi, It works fine for me. I have total 550 pages in two reports. I am exporting it to html, pdf, xls, and rtf format. In all format it is working fine. Could you provide your code for reference. Aditya
  8. Hi, It is still dont work . Do you have any other solution. Attached is the jrxml file for your reference. Aditya [file name=VoiceSession-7e037689d9c580f31f40d4a60a126ca0.jrxml size=34115]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/VoiceSession-7e037689d9c580f31f40d4a60a126ca0.jrxml[/file]
  9. Hi, Fine do following steps. 1. Open the ireport with your report too.Say the report name is "myreport" 2. Goto Edit->reportPropeties->select scriptlet class tab and then choose ireport internal scriptlet editor from scriptlet class drop down menu. Choose language as java. 3. click ok. 4. Now got scriptlet editor, write your public method below the constructor. for example, method name is "numberToRoman". 5. save it and exit. 6. Now whereever you are calling this method, use this expression. (((myreportScriptlet)$P{REPORT_SCRIPTLET}).numberToRoman(<method_parameter>)) 7. Dont move the myreportScriptlet.java and class file where ever it creates. 8. compile and run. It will run the report without any error. Try these steps. Iam sure there is no error and report will run fine. Aditya
  10. HI, You can use set the datasource in ireport to JavaBean Collection Datasource, which allow us to print the data using purposely written java classes. The JavaBean set datasource uses an external class (named Factory) to produce some objects (the JavaBean) that constitute the data to pass to the report. In ireport, Goto Data -> Connections / Datasources -> new. The parameters for the datasource configuration will be: Name: TestFactoryDataSource(user defined) Type of Datasource : JavaBean set Datasource class: Test (name of fully classified classpath which is having collection) Method to call: name of method in class Return type: Collection of JavaBean and then Test the connection. After succesful connection, save it. One more thing the class or package should be in classpath of ireport. Go to report query section, select javabean data source tab and type the class name and click read attributes. Your are done. I think this will work for you. Aditya
  11. Hi, You can use JasperReports api. Here is the code which i have written in a servlet, you can convert it to jsp. /*----------------------------------------- import java.io.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.HashMap; import javax.servlet.*; import javax.servlet.http.*; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRExporter; import net.sf.jasperreports.engine.JRExporterParameter; import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.export.JRPdfExporter; public class servlet_test extends HttpServlet {HttpServletRequest request, HttpServletResponse response) { try{ HashMap hm = new HashMap(); Connection con = null; OutputStream ouputStream = null; JRExporter exporter = null; try{ Class.forName("net.sourceforge.jtds.jdbc.Driver"); con = DriverManager.getConnection("jdbc:jtds:sqlserver://serverip:portno/Database_name","user",""password"); } catch (SQLException ex) { ex.printStackTrace(); }catch(ClassNotFoundException cex){ cex.printStackTrace(); } hm.put("report_parameter_name",value); ouputStream = response.getOutputStream(); JasperPrint jasperPrint = JasperFillManager.fillReport(filename,hm,con); response.setContentType("application/pdf"); exporter = new JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream); exporter.exportReport(); } catch (JRException e) { throw new ServletException(e); } finally { if (ouputStream != null) { try { ouputStream.close(); } catch (IOException ex) { } } else{ response.flushBuffer(); } } } Aditya
  12. Hi, When you are using internal scriptlet editor, ireport save the java and class file in the same directory where the jrxml file stored. So it is neccessary to have jrxml file in the same folder where scriptlet.java file exist, if your are compiling the jrxml file later. One more thing, if the scriptlet is handled internally by iReport, when the report is compiled, a new class with the same name as the report, followed by the postfix “Scriptlet.java†is created. For example, if you have a report named test, the generated scriptlet file will be named testScriptlet.java. Where are using the scriptlet in report? Aditya
  13. Hi, When you are using internal scriptlet editor, ireport save the java and class file in the same directory where the jrxml file stored. So it is neccessary to have jrxml file in the same folder where scriptlet.java file exist, if your are compiling the jrxml file later. One more thing, if the scriptlet is handled internally by iReport, when the report is compiled, a new class with the same name as the report, followed by the postfix “Scriptlet.java†is created. For example, if you have a report named test, the generated scriptlet file will be named testScriptlet.java. Where are using the scriptlet in report? Aditya
  14. Hi, When you are using internal scriptlet editor, ireport save the java and class file in the same directory where the jrxml file stored. So it is neccessary to have jrxml file in the same folder where scriptlet.java file exist, if your are compiling the jrxml file later. One more thing, if the scriptlet is handled internally by iReport, when the report is compiled, a new class with the same name as the report, followed by the postfix “Scriptlet.java†is created. For example, if you have a report named test, the generated scriptlet file will be named testScriptlet.java. Where are using the scriptlet in report? Aditya
  15. Hi, I am using jasper reports and ireport to desing the report. The report is having a jpg image. I am giving the relative path to image in 'image expresion' field of ireport i.e "/client/resource/image/playUp.jpg" The report is exported to differnet format(PDF, XLS, RTF) using web application i.e using jasper report API The problem is that image is not getting rendered in PDF, XLS and RTF format. For HTML it is working fine. The relative path starts from web application root. How can i get images in pdf, xls, and rtf format providing the relative path . Is there any way to embedd the image in pdf, xls, and rtf format. Thanks Aditya Post edited by: aditya_gupta, at: 2007/06/27 09:31
  16. Hi, There is another way to do this. You can use Jasper_Print_List paramter of JRPdfExporterParamter class which accepts a collection object. The collection object is having all jasperPrint object. Following is the modified code, use this istead of your code. import java.util.HashMap; import net.sf.jasperreports.engine.JREmptyDataSource; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRPrintPage; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.util.JRLoader; public class TestOrientation{ public static void main(String[] args) { JasperPrint jasperPrintMain; JasperReport jasperReportMain; JasperPrint jasperPrintSub; JasperReport jasperReportSub; HashMap repParameters = new HashMap(); JREmptyDataSource dataSource = new JREmptyDataSource(); try { jasperReportMain = (JasperReport)JRLoader.loadObject("C:main.jasper"); jasperPrintMain = JasperFillManager.fillReport( jasperReportMain, repParameters, dataSource); jasperReportSub=(JasperReport)JRLoader.loadObject("C:sub.jasper"); jasperPrintSub = JasperFillManager.fillReport( jasperReportSub, repParameters, dataSource); ArrayList jasperPrintList = new ArrayList(); jasperPrintList.add(jasperPrintMain); jasperPrintList.add(jasperPrintSub); JRExporter exporter = new JRPdfExporter(); exporter.setParameter(JRPdfExporterParameter.JASPER_PRINT_LIST, jasperPrintList); exporter.setParameter(JRPdfExporterParameter.OUTPUT_FILE, new File("C:testMerge.pdf")); exporter.exportReport(); } catch ( JRException e){ e.printStackTrace(); } } } Aditya Post edited by: aditya_gupta, at: 2007/06/27 06:29
  17. Hi, Please explain your problem in detail. Are you changing the data type in report query? Aditya
  18. ya thats right. This is the better appproach to have count of sales order based on sales person name. Aditya
  19. Hi, Have you configured the web.xml file properly means it should have mapping of ImageServlet Class. Following is the code snippet which must be used in web.xml for having images in html format. ----------------------------------------------------- <servlet> <servlet-name>ImageServlet</servlet-name> <servlet-class> net.sf.jasperreports.j2ee.servlets.ImageServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>ImageServlet</servlet-name> <url-pattern>/image</url-pattern> </servlet-mapping> ----------------------------------------------------- and one more thing, you dont have to use the following code snippet in your code. ------------------------------------------------ Map imagesMap=new HashMap(); request.getSession().setAttribute("IMAGES_MAP",imagesMap); htmlExporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP,imagesMap); --------------------------------------------------- Try it, It should work for you. It works for me fine. Aditya
  20. Use backward slash and "n" instead of "/n" in database value. In my last reply, I have written the same but editre takes it as only n. Now it will work. I am sure. I have tried it. Aditya Post edited by: aditya_gupta, at: 2007/06/27 04:34
  21. you can find at %root%iReport-1.3.0eclipsecom.jaspersoft.ireport.eclipseiconsireport_icon_mini.png. Its a 16X16 png file. I am also attaching the image. Aditya ]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/ireport_icon_mini.png
  22. Hi, You can use "n" in database column values. For example: Database table test schema is, +--------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+-------------+------+-----+---------+-------+ | id | int(11) | YES | | NULL | | | descrp | varchar(50) | YES | | NULL | | +--------+-------------+------+-----+---------+-------+ and i have inserted one record i.e INSERT INTO test values(1, 'My name is aditya.n I am using jasperreports.'); So when you access the field descrp the data shows in two lines. Aditya
  23. Hi, You can use "n" in database column values. For example: Database table test schema is, +--------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+-------------+------+-----+---------+-------+ | id | int(11) | YES | | NULL | | | descrp | varchar(50) | YES | | NULL | | +--------+-------------+------+-----+---------+-------+ and i have inserted one record i.e INSERT INTO test values(1, 'My name is aditya.n I am using jasperreports.'); So when you access the field descrp the data shows in two lines. Aditya
×
×
  • Create New...