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

p_a

Members
  • Posts

    59
  • 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 p_a

  1. Hi, I got the solution.Here is the code for the ones who have the same problem. new Double($F{id}.longValue()==1 ? ($F{b}.doubleValue()!=0? (($F{a}.doubleValue())*100)/($F{b}.doubleValue()): 0): (($F{b}.doubleValue()!=0? (($F{c}.doubleValue())*100)/($F{b}.doubleValue()): 0) ) ) Thank you, Pegah
  2. Hi, I have a condition statement as showed below: if(id==1){ a*100/b } else{ c*100/b } iReport Format : new Double($F{id}.longValue()==1? (($F{a}.doubleValue())*100)/($F{b}.doubleValue()): (($F{c}.doubleValue())*100)/($F{b}.doubleValue())) Now I wanna do another check for denominator, b, if(id==1){ if(b!=null){a*100/b} else{doOther thing} } else{ if(b!=null){c*100/b} else{doOther thing} } I don't know how could I write the new condition in ireport format. Looking forward any tip. Thank you, Pegah
  3. Hi lshannon, Thanks for your reply.I'll use your tip and will see if it works in my report as well. Thank you, Pegah
  4. Hi, I solved my problem with putting my textFields in Frame.This may not be a good solution but I could not find any:( Another case I faced with my reports is, when I change my report several times sometimes the changes did not work well and make my report unusual!!! I still am looking forward the better solution and appreciate any help and suggestion. Thank you, Pegah
  5. Hi, I have a report with 2 sub reports in it.when I generate the html report the textField width size changes according to its content. I set the textField property stretch type:No stretch and I use the following code in my servlet to generate html report: Code: JRHtmlExporter exporterHTML = new JRHtmlExporter(); ByteArrayOutputStream htmlReport = new ByteArrayOutputStream(); request.getSession().setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrint); exporterHTML.setParameter(JRHtmlExporterParameter.IMAGES_URI,"image?image="«»); exporterHTML.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN,Boolean.FALSE); exporterHTML.setParameter(JRHtmlExporterParameter.JASPER_PRINT, jasperPrint); exporterHTML.setParameter(JRHtmlExporterParameter.OUTPUT_STREAM, htmlReport); exporterHTML.setParameter(JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE); exporterHTML.setParameter(JRHtmlExporterParameter.IS_WRAP_BREAK_WORD,Boolean.TRUE); exporterHTML.setParameter(JRHtmlExporterParameter.BETWEEN_PAGES_HTML,"<div style='page-break-after:always'></div>" ); exporterHTML.setParameter(JRHtmlExporterParameter.FRAMES_AS_NESTED_TABLES,false); But as you see in the image I took from my report the width of my html report changes,it is just happened in html not in pdf. I searched a lot and tried all solutions I found but still the problem exist! Hope some one could give me a clue. Thank you, Pegah Post edited by: p_a, at: 2008/04/27 09:38 Post edited by: p_a, at: 2008/04/27 09:55 Post edited by: p_a, at: 2008/04/27 10:06
  6. Hi, I solved my problem.Just need to change some lines of code in this way: JRDesignField fieldVal = (JRDesignField) fieldList.get(i); String strField = fieldVal.getName(); expression.setText("$F{" + strField + "}"); Hope it also helped others who wanted to make dynamic reports. Thank you, Pegah
  7. Hi, I find the problem in my program.I have to new textField in each textField I want to have in detail band. textField = new JRDesignTextField(); And now I got another problem.As I said in previous post I want my column to be dynamic so I used this code for that : Code: int x = 0; List fieldList = jd.getFieldsList(); for(int i = 0;i<fieldList.size(); i++){ textField.setBlankWhenNull(true); textField.setWidth(107); textField.setHeight(55); textField.setX(x); textField.setY(0); textField.setRemoveLineWhenBlank(true); textField.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER); textField.setVerticalAlignment(JRAlignment.VERTICAL_ALIGN_MIDDLE); textField.setStyle(normalStyle); textField.setBold(true); expression = new JRDesignExpression(); expression.setValueClass(java.lang.Integer.class); String fieldVal = fieldList.get(i).toString(); expression.setText(new String("$F{fieldVal}"«»)); expression.getText(); textField.setExpression(expression); band.addElement(textField); x = x + 107; } But the problem is when I want to setText in expression it gives me an error.It could not load the name of the field!!!! I would appreciate anyone who read this post and find a solution for it. Thank you, Pegah
  8. Hi again, Teodor thanks for concerning my previous post about /demo/samples/noxmldesign and your answer. It was helpful and now I pretty well understand the code. Now I faced a problem loading my fields value into Detail band. All parts of my report works well except detail band:S Here is my code: Code: public class JasperDesignMaker {//This is the inner class I used in my project JasperDesign jd; JRDesignStyle normalStyle; JRDesignStyle boldStyle; JRDesignParameter parameter; JRDesignQuery query; JRDesignField field; JRDesignBand band; JRDesignLine line; JRDesignStaticText staticText; JRDesignTextField textField; JRDesignExpression expression; public JasperDesignMaker(){ } public JasperDesign JasperMaker() throws JRException{ try{ jd = new JasperDesign(); //Page Properties jd.setPageWidth(595); jd.setPageHeight(842); jd.setColumnWidth(535); jd.setColumnCount(1); jd.setColumnSpacing(0); jd.setLeftMargin(30); jd.setRightMargin(30); jd.setTopMargin(20); jd.setBottomMargin(20); jd.setPrintOrder(jd.PRINT_ORDER_VERTICAL); jd.setWhenNoDataType(jd.WHEN_NO_DATA_TYPE_ALL_SECTIONS_NO_DETAIL); jd.setName("Template Report"«»); jd.setOrientation(jd.ORIENTATION_PORTRAIT); //Font Properties //Normal Font normalStyle = new JRDesignStyle(); normalStyle.setName("Sans_Serif"«»); normalStyle.setFontName("SansSerif"«»); normalStyle.setDefault(true); normalStyle.setFontSize(12); normalStyle.setPdfFontName("Helvetica"«»); normalStyle.setPdfEncoding("Cp1252"«»); normalStyle.setPdfEmbedded(true); jd.addStyle(normalStyle); //Bold Font boldStyle = new JRDesignStyle(); boldStyle.setName("Sans_Serif_Bold"«»); boldStyle.setFontName("SansSerif"«»); boldStyle.setFontSize(12); boldStyle.setBold(true); boldStyle.setPdfFontName("Helvetica-Bold"«»); boldStyle.setPdfEncoding("Cp1252"«»); boldStyle.setPdfEmbedded(true); jd.addStyle(boldStyle); //Parameters parameter = new JRDesignParameter(); parameter.setName("param0"«»); parameter.setValueClass(java.lang.String.class); jd.addParameter(parameter); parameter = new JRDesignParameter(); parameter.setName("param1"«»); parameter.setValueClass(java.lang.String.class); jd.addParameter(parameter); parameter = new JRDesignParameter(); parameter.setName("param2"«»); parameter.setValueClass(java.lang.String.class); jd.addParameter(parameter); parameter = new JRDesignParameter(); parameter.setName("param3"«»); parameter.setValueClass(java.lang.String.class); jd.addParameter(parameter); parameter = new JRDesignParameter(); parameter.setName("param4"«»); parameter.setValueClass(java.lang.String.class); jd.addParameter(parameter); parameter = new JRDesignParameter(); parameter.setName("dbQuery"«»); parameter.setValueClass(java.lang.String.class); jd.addParameter(parameter); //Query query = new JRDesignQuery(); query.setText("select * from test"«»); jd.setQuery(query); //Fields field = new JRDesignField(); if(param0!=null){ field.setName(param0.toSting()); field.setValueClass(java.lang.Integer.class); jd.addField(field); } if(param1!=null){ field.setName(param1.toString()); field.setValueClass(java.lang.Integer.class); jd.addField(field); } if(param2!=null){ field.setName(param2.toString()); field.setValueClass(java.lang.Integer.class); jd.addField(field); } if(param3!=null){ field.setName(param3.toString()); field.setValueClass(java.lang.Integer.class); jd.addField(field); } if(param4!=null){ field.setName(param4.toString()); field.setValueClass(java.lang.Integer.class); jd.addField(field); } //Report Bands //Title band = new JRDesignBand(); band.setHeight(50); line = new JRDesignLine(); line.setX(0); line.setY(0); line.setWidth(535); line.setHeight(0); band.addElement(line); staticText = new JRDesignStaticText(); staticText.setText("Report Template Test"«»); staticText.setHeight(50); staticText.setWidth(535); staticText.setTopPadding(0); staticText.setLeftPadding(0); staticText.setStyle(boldStyle); staticText.setFontSize(22); staticText.setPositionType(JRElement.POSITION_TYPE_FIX_RELATIVE_TO_TOP); staticText.setStretchType(JRElement.STRETCH_TYPE_NO_STRETCH); staticText.setMode(JRElement.MODE_TRANSPARENT); staticText.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER); staticText.setVerticalAlignment(JRAlignment.VERTICAL_ALIGN_MIDDLE); staticText.setLineSpacing(JRTextElement.LINE_SPACING_SINGLE); staticText.setBold(true); staticText.setPadding(0); band.addElement(staticText); jd.setTitle(band); //PageHeader band = new JRDesignBand(); band.setHeight(0); jd.setPageHeader(band); band = new JRDesignBand(); band.setHeight(0); jd.setDetail(band); band = new JRDesignBand(); band.setHeight(0); jd.setPageFooter(band); band = new JRDesignBand(); band.setHeight(0); jd.setSummary(band); //Column header band = new JRDesignBand(); band.setHeight(55); textField = new JRDesignTextField(); textField.setBlankWhenNull(true); textField.setWidth(107); textField.setHeight(55); textField.setLeftPadding(0); textField.setTopPadding(0); textField.setRemoveLineWhenBlank(true); textField.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER); textField.setVerticalAlignment(JRAlignment.VERTICAL_ALIGN_MIDDLE); textField.setStyle(boldStyle); textField.setBold(true); expression = new JRDesignExpression(); expression.setValueClass(java.lang.String.class); expression.setText("$P{param0}"«»); textField.setExpression(expression); band.addElement(textField); textField = new JRDesignTextField(); textField.setBlankWhenNull(true); textField.setWidth(107); textField.setHeight(55); textField.setX(107); textField.setY(0); textField.setRemoveLineWhenBlank(true); textField.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER); textField.setVerticalAlignment(JRAlignment.VERTICAL_ALIGN_MIDDLE); textField.setStyle(boldStyle); textField.setBold(true); expression = new JRDesignExpression(); expression.setValueClass(java.lang.String.class); expression.setText("$P{param1}"«»); textField.setExpression(expression); band.addElement(textField); textField = new JRDesignTextField(); textField.setBlankWhenNull(true); textField.setWidth(107); textField.setHeight(55); textField.setX(214); textField.setY(0); textField.setRemoveLineWhenBlank(true); textField.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER); textField.setVerticalAlignment(JRAlignment.VERTICAL_ALIGN_MIDDLE); textField.setStyle(boldStyle); textField.setBold(true); expression = new JRDesignExpression(); expression.setValueClass(java.lang.String.class); expression.setText("$P{param2}"«»); textField.setExpression(expression); band.addElement(textField); textField = new JRDesignTextField(); textField.setBlankWhenNull(true); textField.setWidth(107); textField.setHeight(55); textField.setX(321); textField.setY(0); textField.setRemoveLineWhenBlank(true); textField.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER); textField.setVerticalAlignment(JRAlignment.VERTICAL_ALIGN_MIDDLE); textField.setStyle(boldStyle); textField.setBold(true); expression = new JRDesignExpression(); expression.setValueClass(java.lang.String.class); expression.setText("$P{param3}"«»); textField.setExpression(expression); band.addElement(textField); textField = new JRDesignTextField(); textField.setBlankWhenNull(true); textField.setWidth(107); textField.setHeight(55); textField.setX(428); textField.setY(0); textField.setRemoveLineWhenBlank(true); textField.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER); textField.setVerticalAlignment(JRAlignment.VERTICAL_ALIGN_MIDDLE); textField.setStyle(boldStyle); textField.setBold(true); expression = new JRDesignExpression(); expression.setValueClass(java.lang.String.class); expression.setText("$P{param4}"«»); textField.setExpression(expression); band.addElement(textField); jd.setColumnHeader(band); //Detail band = new JRDesignBand(); band.setHeight(55); textField = new JRDesignTextField(); textField.setBlankWhenNull(true); textField.setWidth(107); textField.setHeight(55); textField.setX(0); textField.setY(0); textField.setRemoveLineWhenBlank(true); textField.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER); textField.setVerticalAlignment(JRAlignment.VERTICAL_ALIGN_MIDDLE); textField.setStyle(normalStyle); textField.setBold(true); expression = new JRDesignExpression(); expression.setValueClass(java.lang.Integer.class); expression.setText("$F{Vac}"«»); textField.setExpression(expression); band.addElement(textField); textField = new JRDesignTextField(); textField.setBlankWhenNull(true); textField.setWidth(107); textField.setHeight(55); textField.setX(107); textField.setY(0); textField.setRemoveLineWhenBlank(true); textField.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER); textField.setVerticalAlignment(JRAlignment.VERTICAL_ALIGN_MIDDLE); textField.setStyle(normalStyle); textField.setBold(true); expression = new JRDesignExpression(); expression.setValueClass(java.lang.Integer.class); expression.setText("$F{Vbc}"«»); textField.setExpression(expression); band.addElement(textField); textField = new JRDesignTextField(); textField.setBlankWhenNull(true); textField.setWidth(107); textField.setHeight(55); textField.setX(214); textField.setY(0); textField.setRemoveLineWhenBlank(true); textField.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER); textField.setVerticalAlignment(JRAlignment.VERTICAL_ALIGN_MIDDLE); textField.setStyle(normalStyle); textField.setBold(true); expression = new JRDesignExpression(); expression.setValueClass(java.lang.Integer.class); expression.setText("$F{Vca}"«»); textField.setExpression(expression); band.addElement(textField); textField = new JRDesignTextField(); textField.setBlankWhenNull(true); textField.setWidth(107); textField.setHeight(55); textField.setX(321); textField.setY(0); textField.setRemoveLineWhenBlank(true); textField.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER); textField.setVerticalAlignment(JRAlignment.VERTICAL_ALIGN_MIDDLE); textField.setStyle(normalStyle); textField.setBold(true); expression = new JRDesignExpression(); expression.setValueClass(java.lang.Integer.class); expression.setText("$F{Ica}"«»); textField.setExpression(expression); band.addElement(textField); textField = new JRDesignTextField(); textField.setBlankWhenNull(true); textField.setWidth(107); textField.setHeight(55); textField.setX(428); textField.setY(0); textField.setRemoveLineWhenBlank(true); textField.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER); textField.setVerticalAlignment(JRAlignment.VERTICAL_ALIGN_MIDDLE); textField.setStyle(normalStyle); textField.setBold(true); expression = new JRDesignExpression(); expression.setValueClass(java.lang.Integer.class); expression.setText("$F{Iac}"«»); textField.setExpression(expression); band.addElement(textField); jd.getExpressions(); int s = jd.getFieldsList().size(); List f = jd.getFieldsList(); int sz = f.size(); f.get(0); jd.setDetail(band); //Column footer band = new JRDesignBand(); band.setHeight(0); jd.setColumnFooter(band); //Page footer band = new JRDesignBand(); band.setHeight(0); jd.setPageFooter(band); //Summary band = new JRDesignBand(); band.setHeight(0); jd.setSummary(band); }catch(JRException ex){ throw new JRException(ex.getMessage());//If the throw exception throws catch it here } return jd; } } As my fields will be dynamic and being selected by each user so I put condition on my field to load only existed fields. But to test it for the first time I load all fields but nothing showed at Detail bands!!!!! Where I am doing wrong????? Teodor I do appreciate you to help one more time and make things clear to me. I am so looking forward to your reply, Thank you. Pegah
  9. Hello Teodor, I searched in forums for making dynamic report and found that I can use the examples in /demo/samples/noxmldesign package as you mentioned. But one thing I could not understand is 1-What would be "args" in main method? 2-About the task name can you explain more. I appreciate your concern and would be so great if you make me clear. Thank you, Pegah
  10. Hi vinays84, Thanks for your help.It works:P
  11. Hello all, I am working with iReport2.0.1 and wanna send query as a string to iReport.So I define a string parameter and set the query as its default value: "select * from test" as a default value for $P{dbQuery},but the problem is the iReport database could not understand String parameter and give me an exception!!!!! It says : {You have an error in your sql syntax;check the manual that corespondens to your SQL server version for the right syntax to use near "select * from test" !!!} Can anyone please tell me where did I wrong??????? Thank you, Pegah
  12. Hi all again, After searching and working on my problem a lot I found a way that solved most of my problem. It is not a correct solution but at least I can get a better look for my reports. I did the report for the web application so these two lines of code has to add to the Servlet. exporterHTML.setParameter(JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE); exporterHTML.setParameter(JRHtmlExporterParameter.BETWEEN_PAGES_HTML,"<div style='page-break-after:always'></div>" ); I hope Jasper group team could solve this problem in the next version. Thank you. Pegah
  13. Hi all again, After searching and working on my problem a lot I found a way that solved most of my problem. It is not a correct solution but at least I can get a better look for my reports. I did the report for the web application so these two lines of code has to add to the Servlet. exporterHTML.setParameter(JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE); exporterHTML.setParameter(JRHtmlExporterParameter.BETWEEN_PAGES_HTML,"<div style='page-break-after:always'></div>" ); I hope Jasper group team could solve this problem in the next version. Thank you. Pegah
  14. Hello all; I posted this problem in iReport Forum too but seems no one could help me. Please got through this link where I report a bug with the complete explanation. Please consider my post and help me.I am so confused :blink: http://jasperforge.org/sf/go/artf2303?nav=1
  15. Hi again, This is the link I reported a bug with its details explained.I do need your help and would be so glad if somebody at least read my post and reply it. http://jasperforge.org/sf/go/artf2303?nav=1
  16. Hi all, How am I supposed to make iReport engine understand where to put break points when it comes to print my html report??????! Is there really a way to solve it? I asked this question some months ago and found that as a bug.So I reported it to the iReport group but as this bug is not being solved and even no one tried to answer me,I thought maybe I missed something or it is being solved before!!!!Now I am really disappointed over this:( :( I really need to have this feature in my reports and did not know what should I do with it. I would appreciate any of you that help me to take over this problem. Thanks alot. Pegah Ansari
  17. Hello, I report a bug some times ago and would like to know if this bug is being followed or not and also is it being solved or not??! I don't know how I am supposed to do that and would be glad if someone guide me about it. Thank you, Pegah
  18. Hi again, I found a solution for my problem. By changing the browser's page's size top and bottom margin to 25mm(in File-Page Setup) I can get the correct result for printing my records. And I guess it is the bug of IReport engine that can not calculate the right size of the page according to its content and introduce page breaks. I hope in the next version of IReport the problem is being solved. Thank you, Pegah Ansari P.S:For the ones who may have seen this form and wanted to know about the problem ,they should see " Automatcally set the content to the paper size?".
  19. Hi Teodor; First of all thanks for taking your time and reading my mail. According to my previous post "Automatcally set the content to the paper size? " I found a solution in JasperReport site "Tips & Tricks",third part "Bands larger than one page". http://jasperreports.sourceforge.net/tips.tricks.html#friendly But the solution was not work for me and in my opinion is not that much practical. Is there any other solution other than that? I am so looking forward to your reply. Thanks in advance, Pegah
  20. Sorry,I forget to attach the picture and now here it is. [file name=report-5c71e2b3b6c1d5838947cafac70ee953.zip size=75368]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/report-5c71e2b3b6c1d5838947cafac70ee953.zip[/file] Post edited by: p_a, at: 2007/06/09 11:55
  21. Hi, How does Ireport manage report contents in each page? I want my report to manage contents automatically and when my contents finish start a new content in the new page. My report is now like this Row1 Row2 . . . Row20 then Row1 Row2 Row3 of a new table also print in the first page.Is it possible for Ireport to manage content automatically then print then put the others in the new page? I also attach the picture of the report I have problem with. I want my report to set its content to the paper size. Thanks Pegah Post edited by: p_a, at: 2007/06/09 11:50
  22. I can solve my problem. Just need to write this expression: new Boolean($V{REPORT_COUNT}.intValue()==20) Hope it helps others as well.
  23. Hello all, I have a report which has a dynamic data. I know that IReport will manage dynamic data in the way that after number of records in one page the others would be in another page but my problem is that in some pages after 20 records(for example) there would be 5 records of new table and when I want to print my report these 5 records also printed with other 20 records. I want a report that start a new page by some new records.! I searched a lot I know that this maybe done by 'Start on a new Page' property and I also define a group header and put my column header on that part and right after it is my detail,but the expression I have to use to make IReport understand when I need my records go to the new page is difficult to write.Can anybody help me which expression I have to write to have the proper result??? I also use page break element and write the following expression at the print when expression but I got an error:( new Boolean(($V{REPORT_COUNT}.intValue>20))?true:false I would be so grateful if someone consider my problem and help to solve it. Thanks. Pegah Post edited by: p_a, at: 2007/06/09 07:58 Post edited by: p_a, at: 2007/06/09 07:59
  24. p_a

    samples/Demo

    Hi, You can download the sample/demo which is in jasperreport 1.2.7 -project.zip from the the follwing link: http://sourceforge.net/project/showfiles.php?group_id=36382&release_id=449159 You will see new version also in here. Hope it could help you. Pegah
  25. Hi, Thanks for your reply. I made my report as you said but I get the same result as I attach in report1.jpg!!!!! Can you give me an example where I can see what you've done correctly? Thanks in advance,I am waiting for your reply.
×
×
  • Create New...