Jump to content
Changes to the Jaspersoft community edition download ×


  • Posts

  • Joined

  • Last visited

redwine's Achievements

  1. Situation: We are using 2.0.4 to render a report that was created with an older version (2.0.2). It is throwing several warnings: "WARNING: The 'leftBorderColor' attribute is deprecated. Use the <pen> tag instead" Question: Is there supposed to be a way for a report created with older versions of iReport to be compiled with the new version 2.0.4? If there is, how is it done or how should iReport be configured? Thanks! redwine Post edited by: redwine, at: 2008/02/05 14:24
  2. Lucian, Thanks for that bit of information. I'm sure it will help me with my task. Regards! Edwin
  3. Datasource with Encapsulated Fields Greetings! I will try to explain my situation briefly but with as much detail as possible before I ask my question. Situation: Up to this time, I have been using collections of plain JavaBeans whose fields are accessible through getters and setters. This has worked well for me with very little need of further manipulation or conversion. Just recently, I was asked if I could create a report using JavaBeans (datasource) whose fields and values (the actual report parameters) are encapsulated within one or more custom classes. Normally I would use a regular bean constructed with its fields accessible through its getter and setter methods. In this setup the report parameter's name would simply be the name of the bean's field and the report parameter's value would be the value of that field accessed through the bean's corresponding getter method. What I am required to use is a bean whose field names and corresponding values are encapsulated (one or more levels) within custom objects like the Field object. Further, several Field objects specific to a particular bean are contained in a Collection of Field objects... Map<String fieldName, Field field> fields. I may also need to work with beans which have additional levels of encapsulation where a bean has a Collection of DataGroup objects each having a Map of Field objects each containing the name and value that will both be used to create a report parameter (passed to a Report's parameters map). class Person - Map<String groupName, DataGroup group> dataGroups class DataGroup - Map<String, Field> fields class Field - String fieldName - Object fieldvalue * fieldName and fieldValue will eventually become a single parameter in the report parameters map - Map<String, Object> parameters. fieldValue will have to be cast into the type used by the corresponding report parameter. * the report would have a parameter $P{fieldName} whose value will be the value of fieldValue I have created an Extractor class to extract the fieldNames and fieldValues that are needed to create each of the report parameters. Some sort of Factory class. Question: Does JasperReports allow the direct use of beans whose fields are encapsulated by (a collection of) other custom classes without the need for a Factory class? If at all possible, what would be the correct way to do it? Thanks! Post edited by: redwine, at: 2008/01/28 19:12
  4. broschb, Thanks for the reply. Your reply has actually sparked several ideas but I also have a couple of questions to ask just to clarify some things about the information passed to the report. Would it be correct to say that if I needed to use information coming from different objects (beans) and have them printed on a single report, I would need to create a Class (ReportBean) whose instance would contain variables corresponding to each of the different parameters/fields indicated in the report template? Would it be necessary to ensure that the type of each corresponding (ReportBean) variable be the same as the type of each corresponding parameter/field in the report template before they are passed to the report? If I correctly understood your previous post, I would have a single bean in the parameters map that I pass to the main report... That bean would, in turn, have all the parameters needed to fill the report. I also need to clarify something regarding parameter maps passed to a subreport. I saw in one of your recent posts that parameter maps are simply parameters passed to the main report. Does this mean that I need to declare a variable of type Map in my ReportBean for each parameter map that I need to pass to different subreports? Sorry if my questions go around in circles. I do hope you could decipher what I am trying to ask you. :) Edwin Post edited by: redwine, at: 2007/08/20 21:11
  5. broschb, I have a question similar the one you replied to recently. It's about using multiple JRBeanDataSource objects to fill a report. You may want to click on the link that follows so you could see my post and maybe shed some light on this matter. http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&func=view&id=29640&catid=8 Thanks in advance! edwin
  6. This is is a question for those who are well versed in using JRBeanCollectionDataSources as my question is related to generating reports using more than one JRBeanCollectionDataSource. I have created two report templates (persons & departments) each getting data from two different bean collections (TestBeanPerson & TestBeanDepartment). I have also written a java app (ReportGenerator.java) that generates a PDF report using the actual .jrxml file and data from specified bean collection (persons or departments). When the reports are generated separately, they both output the information from the corresponding beans correctly. I have also created a third report template which combines the first two reports... a table for persons and a table for departments in a single report. Unlike the other two reports, I have not been able to generate the pdf for the consolidated (third) report. A have previously used JRResultSetDataSources. I'm quite certain that there is something similar to getting data from different tables in a database and mapping their values into their corresponding parameters / fields. I just don't know what the equivalent is when using bean collections. I'm currently stuck with the following questions: How do you fill a SINGLE report using data from more than one bean collection (different Objects)? Is it possible to consolidate different objects into a single JRDataSource? Other alternatives? I have attached the .java & .jrxml files I used. I hope someone would be kind enough to share thier secrets and shed light on this matter. Thanks in advance! PS: Please note that you need to manually modify the ReportGenerator class to generate the first two reports: For generating the person report: On LINE 29 type fileName = "aaa_070808_JRBCDS_sub01" & On LINEs 47 - 48 type JasperPrint jp = JasperFillManager.fillReport(pathJasper, new HashMap(), persons); For generating the department report: On LINE 29 type fileName = "aaa_070808_JRBCDS_sub02" & On LINEs 47 - 48 type JasperPrint jp = JasperFillManager.fillReport(pathJasper, new HashMap(), departments); aaa_070808_JRBCDS_sub03.jrxml is the file containing both person and department tables. Edwin [file name=MultipleBeans.zip size=5898]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/MultipleBeans.zip[/file] Post edited by: redwine, at: 2007/08/14 22:58
  7. There are three things that you can try: Option 1: The simplest option. Just use an image editor to combine your top and bottom images and merge them into a single image. This way you would only have a single image and it would not add to the slices in your report. The more slices (non-corresponding element edges create additional slices), the slower your report. Option 2: The better option. Place both images on the same band. I assume that's what you are doing. Just make sure that: a) Your image stacking order is how you need it to be. Top image in front, bottom image at the back. Stacking order almost always matters. b) You also have to make sure that your top (front) image is transparent where it needs to be. gif images are recommended if you need to set an image to a certain opacity/transparency. You can't set this in iReports so you need to set transparency before you import the image. This would be the most flexible option to use although you may have to use an image editor to adjust alpha/transparency. Option 3: Nice to know option. Use the background band for images that you need to display in a fixed position on the page like watermarks or maybe images on your letterhead that don't need to move (float)... ABSOLUTE position images. You could then place the image that needs to be on top on the band that you choose. NOTE the following when going for this step: a) The images placed in the background band will display on all pages, b) Images on the background band are in a fixed (ABSOLUTE) position. They will not adjust their position or do not float. c) If elements in any of your upper bands stretch, remember that you will not be able to position an image which is placed on a lower band relative to an image placed in the background band and expect it to display with exactly the same relative positions to each other. :) Simply put... there is no guarantee that your upper image will align properly with an image in the background. A note on reports generated in HTML: You can scale text generated in your report. However (since I last tried) the images in reports generated in HTML do not scale. I have come across a suggestion to just generate the reports in PDF and have them display as a PDF link or image in HTML. You may also want to explore the use of frames with reports that are to be generated in HTML. hth! edwin Post edited by: redwine, at: 2007/08/07 16:41 Post edited by: redwine, at: 2007/08/07 16:48
  8. Santoshi, As far as I know, there is no feature (at least not yet) that allows you to create check boxes. I actually have to create my own check boxes. First create a rectangle element (10 X 10 pixels would be small enough). Create an Image element (8 X 8 pixels if you want to fit the image nicely inside a 10 X 10 Box) This will be the image element that will actually be your check mark or whatever mark you will use. Link the image element to an actual image file in your directory. Do this by right clicking the image element and clicking the Image Tab. Here, type in the path to the image you will be using inside the Image Expression box. You could use an absolute or relative path, whatever works for you. You now have your basic elements for your check box. You now have to align the centers of both your checkbox and your checkmark. It would also be a good idea to make sure the stacking order of your elements are correct, meaning the checkmark must be in fromt of your check box. For your checkbox to work you will have to type in the apropriate Boolean expression. To do this, right click on your check mark image. Select properties and click on the Common tab. At the bottom where it says Print when Expression, type in the Boolean expression that will determine when your checkmark image will be displayed/printed. hth! edwin ** attached is a checkmark image you might want to use :) [file name=checkBlack.gif size=370]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/checkBlack.gif[/file] Post edited by: redwine, at: 2007/08/06 17:43
  9. Badrish Your Date field must be a Text Field (not Static Text) for this to work. In case you have a static field, just do this: Right click on the date field and select Transform in Text Field (F3). This will convert your static text element into a text field element. Now, right click your date text field. Select properties and click on the Text Field tab. In the Text Field Expression Class select java.util.Date. I am assuming that you are passing a date parameter as you have mentioned. In the Evaluation Time, select Now. In the Pattern type in "MM/dd/yyyy" or whatever pattern you need. Lastly, in the text field expression indicate the parameter that you are using like $P{importantDate}. hth! edwin
  10. Unexpected Page Breaking iReport Developers/Users I would like to kindly request feedback from those who have encountered the following issue or something similar? I have a master report with 5 subreports all contained in the detail band. For some reason, a page break is introduced unexpectedly after some of the subreport sections when the report is generated. Please see the attached sample files which include 1 master and 3 subreport files (subreports 2 & 3 are just repeated in the master report to show what is actually happening). I have tried adjusting the band and report heights but those did not resolve the issue. I have also looked into the XML code of each file and did not find any attribute/property which would force a break (or so I think). Could this be connected / related to extra spaces (blank lines) appearing in generated PDF reports? Other reports I have prepared and layed out in a similar way (master with multiple subreports) did not have this unexpected page break. Any feedback would be appreciated. Thanks! edwin [file name=Unexpected_Break.zip size=6678]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/Unexpected_Break.zip[/file]
  11. richard_07 Try doing this: 1) Right click on the text field (the one which you don't want repeating values). 2) Select properties & select the Common tab. 3) Uncheck the Print Repeated Values attribute. This will suppress the printing of repeating values on your generated report. edwin
  12. Kurgane, In version 2.0: Right click the Break element and select Properties. In the properties dialog box click on the All (tab). Scroll down to the bottom. You will see the break property. Select the break type from the dropdown list. Currently there are only 2 selections Page & Column. hth :) Edwin Post edited by: redwine, at: 2007/07/30 18:34
  13. Surendra, Check out the following links to my previous posts. They may help you. http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=&func=view&catid=9&id=25381#25381 http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=&func=view&catid=9&id=23990#23990 hth :) Edwin
  14. umutdogan You could (1) set the left and right borders of your text element to Thin or 1-Point, (2) set the left and right padding to at least 2 (so your text will not be too close to your borders), and (3) set the Stretch Type of yout text element to Relative to Band Height. All these will be set from the element properties window. hth :) Edwin Post edited by: redwine, at: 2007/07/30 17:48
  15. likchin STEP 1: You must first set the external programs that you will be using. On your menu bar click Options > External Programs (tab). You will be using the path to the .exe (executable) file of the program you will be using. Example: You will be needing a PDF Viewer if you need to view how your generated reports look in pdf. You could enter C:Program FilesAdobeAdobe Acrobat 7.0AcrobatAcrobat.exe or browse to the directory where your PDF Viewer executable file is located. You will have to assign the paths to the different viewers if you need them. You may leave them blank if you don't. STEP 2: After that, also make sure that your compilation settings are correct. On your menu bar click Options > Compiler (tab). Set your Default Compilation Directory. This is where your .jasper and .pdf. files will be saved when you compile your report template. Remember where this directory is. Also set the Directory where the paged out data is stored. STEP 3 Lastly, on your menu bar click Build. Select the type of preview you want. This will usually be in PDF. Remember that if you want to preview your report in a specific format, you should have previously done STEPs 1 & 2 for the appropriate file format. hth :) Edwin
  • Create New...