Jump to content
Changes to the Jaspersoft community edition download ×

neetikamittal

Members
  • Posts

    29
  • Joined

  • Last visited

neetikamittal's Achievements

Contributor

Contributor (5/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Collaborator Rare

Recent Badges

0

Reputation

  1. Hi, I tried to do this, I made a jsp page with option buttons, Bsaed upon option One will select ,query will be modified or you can say condition will change dynamically. I am attaching my servlet code and jsp page. All u need is to make a paramater in Ireport GUI and replce the portion of ur query with $!{/name of the parameter} May be this will help u. In this code I am replacing query but u can replace particular parameters also. Thanks Neetika
  2. Hi friends, I report is taking too much of time to generate a html report that I am worried wat will be the real performance when I will try to run it on real production environment. Now I am generating a report with app. 5000 records and it is taking 10 minutes. So can anybody suggest me about how to increas the performance . wat I need to do. I read it somewhere that due to antivirus installation on PC makes it too slow. But can anybody tell me how much time it will take in general to generate a report of 5000 records in html format. Thanks
  3. Hi friends, Is this possible with Ireport that based upon users field selection in an INPUT FORM,only those particular column should appear not the other columns. means if a user selects firstname,homephone,workphone then only those should come on a web based report,not the other columns. I don't want to produce sepearte reports for each possible combination of columns . suggest me some better idea. do I need some other technology to dynamically change my column definations. Thanks Neetika Mittal
  4. Hi Lucian, Actually I am trying to have a customized report. I have a jsp page with one of its field as text field to enter the name of the person which the user wants to see the report. That is why I used prepared statements. My question Is still there. How can I make my $P{homephone} iterate through the string array value against a single key in hashmap. Amber 32473474232 //these phone nos are in string Array Amber 23282842234 //hashmap("homephone",s1) Amber 23278733439 //$P{homephone}should fill these values one by one In Report Design I have $P{firstname} $P{homephone} I already posted the code earlier. U can have look at it. Thanks Neetika
  5. Thanks for ur response. But till now I am working only with JDBC DataSource. I don't know wat kind of changes U r trying to say . Can U explain in detail. Wat Should I need to do ? Do u have any example/code snippets for this. I will be highly obliged. meanwhile I am trying my best to solve this problem. Thanks Neetika
  6. ya I fully understand this But how can I iterate through that array to have corresponding values. also how to fill that $P{homephone} with different values for each person whose first name is 'amber'or smthing else. I didn't find any type other that that where I can define the parameter type as array. Is there any mechanism that can fill the values one by one that is in array? first name is fine but $P{homephone} will be having different values . problem is there. Thanks Neetika
  7. Hi all, I didn't get any answer of my earlier posted query. my question is if I assign a String array against a single key value then How the paramter defined will iterate through that array. My earlier post will help u in better understanding. But I will try again to explain it. I want that if I choose that ok I need all the person's homephone nos whose name is "jane" then I am supposed to create 2 parameters as $P{firstname} and $P{homephone} but so far I am able to get the phone nos. but now how to make the parameter do the iteration I don't know like jane 233989439 jane 343454656 jane 343435455 jane is printing very well but in case of homenos as they will be different parameter should fill the phonenos iteratively. I am really stuck in this did somebody ever tried this kind of situation? Plz let me know. Neetika Mittal
  8. Hey, I also came across the same problem but wen I restart my server It just went away. U can try also. I am working on Tomcat5.5 Hopefully It will work Neetika
  9. Hi Friend, If I tried to put multiple values against a single key in hashmap. Whether the parameter defined in Ireport design phase will automatically iterate through those values one by one against that key. I want to have a report like First Name Homephone Amber 4089874563 Amber 4987654567 Amber 3448768907 here all three Amber are different persons. so I designed a report like this First Name HomePhone $P{firstname} $P{homephone} and write a code like this PreparedStatement stmt = jdbcConnection.prepareStatement("select firstName, homePhone from person where firstName = ?"); stmt.setString(1,name); ResultSet rs = stmt.executeQuery(); ArrayList names = new ArrayList(); while (rs.next()) { names.add(rs.getString("homePhone")); } Object ia[] = names.toArray(); int len=ia.length; String[] s1=new String[len]; for(int i=0;i<len-1;i++) { s1= ia.toString(); } hmap.put("homephone",s1); hmap.put("firstname",name); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,hmap,jdbcConnection); JRHtmlExporter exporter = new JRHtmlExporter(); Map imagesMap = new HashMap(); req.getSession().setAttribute("IMAGES_MAP",imagesMap); exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imagesMap); exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "image?image="); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_WRITER,out); exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN,Boolean.FALSE); exporter.exportReport(); But I think my parameter field is not iterating through the array values that I put in code. So how can I do this thing. it seems in IREPORT hashmap will take only single value against a key. Plz let me know as soon as possible. Thanks Neetika
  10. Hi Friends, Hopefully One of u have gone through mine problem. My problem is I have one parameter named $P{homephone} to display the runtime filled values from database. that HomePhone field is of char[10] in database. So I declared that parameter of type java.lang.String but wen I am running a particular query,multiple values will be returned in result set so I created a arraylist of those values to put against that single key. then I convert that arraylist to string array,so that value can be filled in. But I think when running or filling up the report,that parameter defined their is not iterating the values rather it is giving an error. Could not create the report Incompatible [Ljava.lang.String; value assigned to parameter homephone in the ctisreport1 dataset. Incompatible [Ljava.lang.String; value assigned to parameter homephone in the ctisreport1 dataset. I am attaching a code snippet and also jrxml file for reference. Plz have a look at it. try{ JasperDesign jasperDesign = JRXmlLoader.load(reportFile); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); Class.forName("com.mysql.jdbc.Driver"); Connection jdbcConnection = DriverManager.getConnection(databaseName,userName,password); PrintWriter out = res.getWriter(); Map hmap=new HashMap(); String name = req.getParameter("firstName"); String cb1 = req.getParameter("homeinfo"); if(cb1.equals("on")) { PreparedStatement stmt = jdbcConnection.prepareStatement("select firstName, homePhone from person where firstName = ?"); stmt.setString(1,name); ResultSet rs = stmt.executeQuery(); ArrayList names = new ArrayList(); while (rs.next()) { names.add(rs.getString("homePhone")); } Object ia[] = names.toArray(); int len=ia.length; String[] s1=new String[len]; for(int i=0;i<len-1;i++) { s1= ia.toString(); } hmap.put("homephone",s1); //see here an string array is against a single key,I want that rarameter defined in report,iterate through this array and give the respective values. //String s = rs.getString("homePhone"); // hphones.put("homephone",rs.getString("homePhone")); hmap.put("firstname",name); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,hmap,jdbcConnection); JRHtmlExporter exporter = new JRHtmlExporter(); Map imagesMap = new HashMap(); req.getSession().setAttribute("IMAGES_MAP",imagesMap); exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imagesMap); exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "image?image="); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_WRITER,out); exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN,Boolean.FALSE); exporter.exportReport(); [file name=ctisreport1-358199458018b4d15c8080966996a531.jrxml size=22891]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/ctisreport1-358199458018b4d15c8080966996a531.jrxml[/file]
  11. Hi Friends, u may find me too impatient but I can't wait for too long. actually I tried to put a string array against a single key in hashmap. now wat I think is Parameter field named "homephone" is not able to populate the string array values agaist this single key. I tried to check whether against that key string array values are there or not. My code is printing those values against that key. But now Problemm is Ireport is not filling up those string values against a that key in my Parameter field defined . I defined a field named $P{homephone},drag this field in details section so that runtime values from database can be filled in. here is my code where i tried to pick homephonenos of all the persons whose name is "amber". Most important thing is in database homePhone field is of type char[10] so I declred my parameter homephone as of type java.lang.String and in java code I tried to make a arraylist then converted that arraylist into string array. and then called the HASHMAP's put(key,value) method see the code below. I have slightly modified the code so don't check for prepared statemnets. Map hmap=new HashMap(); String cb1 = req.getParameter("homeinfo"); if(cb1.equals("on")) { PreparedStatement stmt = jdbcConnection.prepareStatement("select firstName, homePhone from person where firstName = 'amber'"); ResultSet rs = stmt.executeQuery(); ArrayList names = new ArrayList(); while (rs.next()) { names.add(rs.getString("homePhone")); } Object ia[] = names.toArray(); int len=ia.length; String[] s1=new String[len]; for(int i=0;i<len-1;i++) { s1= ia.toString(); } hmap.put("homephone",s1); //problem is here only I think so //hmap.put("firstname",name); but when i tried this I am getting all the values against homephone key String[] strings = (String []) hphones.get("homephone"); out.println("length of string array is"+strings.length); for(int i=0;i<strings.length;i++) { //strings= ia.toString(); out.println("value of string "+i +"is"+strings); } but when this servlet code tries to fill the values in parameter fields defined it is showing error like Could not create the report Incompatible [Ljava.lang.String; value assigned to parameter homephone in the ctisreport1 dataset. Incompatible [Ljava.lang.String; value assigned to parameter homephone in the ctisreport1 dataset. so for reference I am attaching jrxml code also. I wish One must have understand my problem. Hope to get the soln very soon [file name=ctisreport1-03818669ee2bcad10ef67e95550ff804.jrxml size=22811]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/ctisreport1-03818669ee2bcad10ef67e95550ff804.jrxml[/file] Post edited by: neetikamittal, at: 2006/09/06 06:17
  12. Hi, I tried to convert the arraylist into an atring array. Phonenos from database are printing very well on console. But in Parameter field values r not coming up. it is empty. can't I put a string array against a single key in hashmap. or I need to do something else so that phonenos can comein from database against the name entered by user. like if user puts "amber" and click checkbox HOMEPHONE as he wants to see the phonenos of all the persons whose name is "amber" and datatype for homePhone in database is char[10]. then wat I need to do . I tried the code attached below and now it is giving the error in tomact log file as Could not create the report Incompatible [Ljava.lang.String; value assigned to parameter homephone in the ctisreport1 dataset. Incompatible [Ljava.lang.String; value assigned to parameter homephone in the ctisreport1 dataset. today only I posted a query with all my code and jrxml file. U can have a look at that. Thanks neetika Post edited by: neetikamittal, at: 2006/09/06 00:20 Post edited by: neetikamittal, at: 2006/09/06 00:22
  13. Hi, My problem is. I want to populate the parameter values against a single key . I created a parameter named homephone ($P{homephone}) of type String as in database values r of type char[10] then in report design I place the same parameter on the detail section. I tried the below code(giving an arraylist values to a single key.and then converting those arraylist values into an array and then to a string array as my parameter is of type string. so plz have a look at the code. and also I am attaching jrxml file for reference. public void runReport(String databaseName, String userName, String password,String reportFile,HttpServletResponse res,HttpServletRequest req) { try{ JasperDesign jasperDesign = JRXmlLoader.load(reportFile); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); Class.forName("com.mysql.jdbc.Driver"); Connection jdbcConnection = DriverManager.getConnection(databaseName,userName,password); PrintWriter out = res.getWriter(); Map hphones=new HashMap(); String name = req.getParameter("firstName"); String cb1 = req.getParameter("homeinfo"); if(cb1.equals("on")) { PreparedStatement stmt = jdbcConnection.prepareStatement("select firstName, homePhone from person where firstName = ?"); stmt.setString(1,name); ResultSet rs = stmt.executeQuery(); ArrayList names = new ArrayList(); while (rs.next()) { names.add(rs.getString("homePhone")); Object ia[] = names.toArray(); int len=ia.length; String[] s1=new String[len]; for(int i=0;i<ia.length;i++) { s1= ia.toString(); } hphones.put("homephone",s1); //String s = rs.getString("homePhone"); // hphones.put("homephone",rs.getString("homePhone")); hphones.put("firstname",name); } JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,hphones,jdbcConnection); JRHtmlExporter exporter = new JRHtmlExporter(); Map imagesMap = new HashMap(); req.getSession().setAttribute("IMAGES_MAP",imagesMap); exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imagesMap); exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "image?image="); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_WRITER,out); exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN,Boolean.FALSE); exporter.exportReport(); [file name=ctisreport1-462ed27cef2de3dc5c0ba85b3aa7badd.jrxml size=22880]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/ctisreport1-462ed27cef2de3dc5c0ba85b3aa7badd.jrxml[/file]
  14. Hi, In the database homephone is defined as type char[10] not of String type. So I defined a parameter homephone with type as java.lang.String and default expression as new String("") I am attaching the jrxml file. plz have a look at it. Thanks Neetika [file name=ctisreport1.jrxml size=22944]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/ctisreport1.jrxml[/file]
  15. Great work. But it don't have query builder. or it is there. b'coz query builder was next release feature. But it looks gud and really a hard work.
×
×
  • Create New...