Jump to content

shesh anand

Members
  • Posts

    4
  • Joined

  • Last visited

shesh anand'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. Look i have generated a report using iReport which fetches me the data from my database and prints it into a pdf ....but now what happens here is that the data the query string is almost same every time...what if i want to let the user decide to choose as to what data he needs to take print of...by this i mean let him choose the data what he wamts to print....that would obviously bring a change in querystring inside report.jrxml...but the problem is how to do that dynamically..... do i need to read that report.jrxml and find the place where i need to replace that selected parameters which i get from request.getParameter() to the required places in that report.jrxml's querystring tag also with a where condition....and then again write it into the same report.jrxml with the updated replaced text and compile it and generate a report.jasper for it... If yes please let me know the code to do this... i mean how to read it..i mean the report.jrxml then find the querystring tag and then make the replacements and then again write the updated report in report.jrxml... also if there is some other solution please let me know that too.... here is that snippet of code which i need to read...do the modifications and write it again to report.jrxml <queryString><![CDATA[sELECT name,surname,address,phoneno FROM myemployees]]></queryString> Also i need to make changes to the field expressions accordingly.. below is the snippet of that too.. <textFieldExpression class="java.lang.String"><![CDATA[$F{name}]]></textFieldExpression> <textFieldExpression class="java.lang.String"><![CDATA[$F{surname}]]></textFieldExpression> <textFieldExpression class="java.lang.String"><![CDATA[$F{address}]]></textFieldExpression> <textFieldExpression class="java.lang.String"><![CDATA[$F{phoneno}]]></textFieldExpression> what i want really is pass the query like select name,surname from myemployees..then it should print the record for those two fields only...if i pass select * from myemployees then it should print all the values...and when i pass select * from myemployees where name='Mr.X'...then for all the values should be shown there for Mr.X ...that means i want good of both worlds.....what's happening is that while i have put the query as following....then again i changed as follows.. The snippets of code are as follows while(resultSet.next()) { String name=resultSet.getString(1); hashMap.put("name",name); System.out.println (hashMap.get("name")); System.out.println (hashMap); } hashMap.put("name",query); System.out.println(hashMap); JasperRunManager.runReportToPdfStream(reportStream,servletOutputStream, hashMap,connection); JasperRunManager.runReportToPdfStream(reportStream,servletOutputStream, hashMap,connection); ...then what i get is a blank report and when i print it on the console then, which i did intially just to confirm whether map has those objects or not...then the values in the map are printed on the console but the report that i get is a big B L A N K...i am using <textFieldExpression ><![CDATA[$P!{name}]]></textFieldExpression> what else do i need to do...is there any <printExpression></printExpression>...please let me know how to use it Regards
  2. Ok... i do not want to offend this forum...but please tell me how to do it in .jrxml ....as i need it...badly....
  3. aahhh...atlast someone replied...what i want really is pass the query like select name,surname from myemployees..then it should print the record for those two fields only...if i pass select * from myemployees then it should print all the values...and when i pass select * from myemployees where name='Mr.X'...then for all the values should be shown there for Mr.X ...that means i want good of both worlds..all that you asked for is what i need...are you there yet!!!:P Post edited by: shesh anand, at: 2007/12/06 17:00
  4. Look i have generated a report using iReport which fetches me the data from my database and prints it into a pdf ....but now what happens here is that the data the query string is almost same every time...what if i want to let the user decide to choose as to what data he needs to take print of...by this i mean let him choose the data what he wamts to print....that would obviously bring a change in querystring inside report.jrxml...but the problem is how to do that dynamically..... do i need to read that report.jrxml and find the place where i need to replace that selected parameters which i get from request.getParameter() to the required places in that report.jrxml's querystring tag also with a where condition....and then again write it into the same report.jrxml with the updated replaced text and compile it and generate a report.jasper for it... If yes please let me know the code to do this... i mean how to read it..i mean the report.jrxml then find the querystring tag and then make the replacements and then again write the updated report in report.jrxml... also if there is some other solution please let me know that too.... here is that snippet of code which i need to read...do the modifications and write it again to report.jrxml <queryString><![CDATA[sELECT name,surname,address,phoneno FROM myemployees]]></queryString> Also i need to make changes to the field expressions accordingly.. below is the snippet of that too.. <textFieldExpression class="java.lang.String"><![CDATA[$F{name}]]></textFieldExpression> <textFieldExpression class="java.lang.String"><![CDATA[$F{surname}]]></textFieldExpression> <textFieldExpression class="java.lang.String"><![CDATA[$F{address}]]></textFieldExpression> <textFieldExpression class="java.lang.String"><![CDATA[$F{phoneno}]]></textFieldExpression>
×
×
  • Create New...