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

augarte

Members
  • Posts

    270
  • 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 augarte

  1. Which is the value of the second field when it doesn't work? Are both fields string type? Could you attach your .jrxml file?
  2. Hi, Try the following: !$F{riepilogo_totaleDichiarazioni}.equals( "" ) || !$F{riepilogo_totaleDistinte}.equals( "" ) ? Boolean.TRUE : Boolean.FALSE Or otherwise this should work also: $F{riepilogo_totaleDichiarazioni}.equals( "" ) && $F{riepilogo_totaleDistinte}.equals( "" ) ? Boolean.FALSE : Boolean.TRUE In this case what you are saying is that the text shoulnd't be printed if both fields (riepilogo_totaleDichiarazoni and riepilogo_totaleDistinte) are empty strings. Hope this helps. Regards
  3. Hi, I have some reports that I'm exporting to excel format. What I want to do now is to add some property for not allowing the user to modify the excel file after generating it. I have checked in iReport and in JRXlsExporterParameter (http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/export/JRXlsExporterParameter.html) but didn't find nothing that solves my problem. Does anybody know how can I achieve that? Thanks in advance! Best regards. Aitor
  4. Hi, In this link you have a list with jars containing this class: http://www.jarfinder.com/index.php/java/info/org.bouncycastle.asn1.DEREncodable Hope this helps. Regards, Aitor
  5. Hello, You can do the following: For each double parameter you have, create another parameter (string type). For example, if you have $P{LCF}, create a $P{LCFstring} parameter. In the parameter "Default Value" attribute set the following: new DecimalFormat ("$0.00").format($P{LCF}) Then, set the expression (+/- " + $P{LCFstring} + (" Fut ~ +/- ") + $P{LCOstring} + " Opt) Don't know if it is the best solution but it should work. Hope this helps. Regards. Aitor
  6. Maybe it was not very clear what I want to do in the previous explanation. In the report I have working, I have a xml file with the structure you can see in the following link: http://pastebin.com/s3y8K0ee Then, if I want to to define a field, I can do it using XPATH as follows: Column[@name=OPENUM]/@value . With this I can have in a field the value of any column which name is "xxxx" (OPENUM in this case). The aim of these is to have the same datasource structure for all the reports. What I want to do now is to have something similar but without using intermediate xml files. So I want a generic way to get the data from the database, map it to some objects and pass these data to the report. My first idea was to use JavaBeanDatasource but don't know how to get the fields. For xml I have XPATH which helps me a lot when getting the field values, but don't know how to do something similar with JavaBeanDatasource. Is it possible? Does anybody know how could I do it? Thanks in advance!Best regards!Aitor
  7. Hi! I'd like to export some reports to use JavaBean datasources (so far I have been using xml datasources). Mi idea was to create "Field" class wich will have two attributes: "name" and "value". So in my datasources I'll have a list of "Field" class, each one with its "name" and "value". My problem is that I don't know how to retrieve the values I want to add them to the report. For example, if I want to get the"value" of the "Field" which "name" is "Prj", but how to define the field description in order to get this value? I have been thinking about it. Maybe an option is to create another Bean that has a list of objects of "Field" type, and implement a function getValueByName (String name) that iterates all the "Field" list and returns the value of the one that matches with the given name. But don't know how to do it. Is this possible? I'm a bit lost, so any help will be very appreciated. Best regards! Aitor
  8. Hi yulia, You can do the following. 1) Retrieve the date as a field (String type). From now on, the name of this field will be 'date'. 2) Create a variable (the name could be 'vardate') with the following (java.util.Date type) with the following variable expression: new SimpleDateFormat ("dd.MM.yyyy").parse($F{date}) 3) Create another variable (java.util.Date type) with Calculation=Highest and Variable Expression=${vardate}, being vardate the variable created in the previous step. This way you'll have the latest date. Hope this helps. Regards, Aitor
  9. Hi Sanbez, Don't know which is the reason but the same happens for me.Might be that some administrator has removed these answers because they were not relevant or are spam messages?
  10. Hi, This works with Integer type field/variable: $F{totalCt} == null ? Integer.valueOf("0") : $F{totalCt}
  11. Have you checked this? http://jasperreports.sourceforge.net/config.reference.html#net.sf.jasperreports.export.csv.field.delimiter I have never used CSV exporter but I guess you can set this property using JRCsvExporterParamter http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/export/JRCsvExporterParameter.html You should right something like the following: JRCsvExporter exporter = new JRCsvExporter(); exporter.setParameter (JRCsvExporterParameter.JASPER_PRINT, YourJasperPrintObject); exporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, "|"); exporter.setParameter(JRCsvExporterParameter.OUTPUT_FILE_NAME, "YourFileName.csv"); exporter.exportReport(); Hope this helps. Regards, Aitor
  12. Hi subashmy, What you can do is to create a variable that depends on the value of $F{totalCt} and another one that depends on $F{totalMin}, the "Variable Expression" should be as follows: $F{totalCt} == null ? Double.valueOf("0.0") : $F{totalCt} --> For $V{TotalCt} variable $F{totalMin} == null ? Double.valueOf("0.0") : $F{totalMin} --> For $V{TotalMin} variable This way, if the value of the fields is null you'll have 0.00 in the variable, and otherwise you'll have the same value you have in the field. The you should change the variable expression in orther to use variables instead of fields: ' Summary Total # of calls: ' + new DecimalFormat("#,000").format($V{totalCt}) + ' Total minutes: ' + new DecimalFormat("#,000").format($V{totalMin}) Maybe there is an easier option but I think this should work for you. Let us know if you solve your problem. Hope this helps, Aitor
  13. What is that exactly? Where are you adding the following expression? ' Summary Total # of calls: ' + new DecimalFormat("#,000").format($F{totalCt}) + ' Total minutes: ' + new DecimalFormat("#,000").format($F{totalMin}) Something is wrong here with this expression. If you check the DecimalFormat javadoc you will see that there is not any "format" function with one parameter: http://docs.oracle.com/javase/6/docs/api/java/text/DecimalFormat.html So you have at least one error in this expression. Anyway, it would be easier to help you if you explain what do you want to do. From the expression I guess you need to add some data using "HTML markup" but don't know exactly what you want. Regards, Aitor
  14. Hi, First of all you need to create a customize class. The following is an example of a Line Chart customizer: package com.almis.awe.chartcustomizer; import java.awt.Color;import java.awt.BasicStroke; import net.sf.jasperreports.engine.JRChart;import net.sf.jasperreports.engine.JRChartCustomizer; import org.jfree.chart.JFreeChart;import org.jfree.data.category.*;import org.jfree.chart.renderer.category.LineAndShapeRenderer; import java.util.HashMap;/** * * @author augarte */public class AweLineChartCustomizer implements JRChartCustomizer{ public static HashMap engGroupColor = new HashMap(); static { engGroupColor.put("A", new Color(0xE4, 0x1B, 0x1B)); engGroupColor.put("B", new Color(0xF1, 0xAB, 0x10)); } public void customize(JFreeChart chart, JRChart jasperChart) { // Category Plot: most commonly used to display bar chart // BarRenderer: create bar charts from data in a category dataset LineAndShapeRenderer renderer = (LineAndShapeRenderer) chart.getCategoryPlot().getRenderer(); // Method required for reading the dataset. // Table of values that can be accessed using row and column keys. CategoryDataset cd = chart.getCategoryPlot().getDataset(); // Row gives the series expression int rc = cd.getRowCount(); for (int i = 0; i < rc; i++) { renderer.setSeriesStroke(i, new BasicStroke(2f)); } } } Then you need to add it to iReport. What I do is to add all my classes to a jar file and the add this file to iReport classpath (Tools->Options->iReport, inside the "classpath" tab). The last step is to say to the chart to use this customize. If you select the chart (inside your report), in the right side you will see that there is a property "customizer class". You have to set the customizer here, in my case. com.almis.awe.chartcustomizer.AweLineChartCustomizer Hope this helps. Best regards, Aitor
  15. Thanks so much sanbez! Now I'm really busy but I'll try to change jfreechart code and I'll let you know. Best regards, Aitor
  16. Hi, I also had to create some reports getting data from Webservices. I guess there is not any connector to webservices, so what I have done is to create some beans where I store the information I got from the webservices and then generate the report using JRBeanCollectionDataSource. Maybe this solution is valid for you also. Hope this helps. Best regards.
  17. I could solve the first question using JFreeChart customizer: public void customize(JFreeChart chart, JRChart jasperChart) { PiePlot3D piePlot3D = (PiePlot3D) chart.getPlot(); ((StandardPieSectionLabelGenerator) piePlot3D.getLabelGenerator()).getPercentFormat().setMaximumFractionDigits(2); } Does anybody know if it is possible doing the second thing? I have chekced setLabelBackgroundPaint function and it is possible to paint the label background with a diffrente colour, but it paints all the labels with the same colour.
  18. Hi, I've managed to create a Pie Chart using my datasource. Now, I would like to do couple of modifications but don't know if this is possible. This is what I want to do: - Show the percentages with two decimals. - Paint the background of the rectangle where the percentages are shown with the colour that corresponds to each key ("Movimiento", "Ralenti" and "Toma de fuerza") Is this possible? Do I have to use JRAbstractChartCustomizer or any other chart customizer? I add an image to see how my pie chart looks. Thanks in advance. Kind regards
  19. Hi! Could you explain your problem more clearly? I don't undertand what are you trying to do. Posting an example could help a lot! Best regars, Aitor
  20. Hi, I made an example for you. What I've done is the following: - As there are 7 different combinations (if I'm not wrong), create 7 static text fields with the text that should write in each case - Modify the "Print When Expression" property to show or not the text in each case - In my case I've created 3 properties to insert their value when running the report. In your case will be variables. I know that this is not the best solution because if you have more than three variables you'll have to modify the report. This solution is valid if you always use these three variables. I attach the example Hope this helps Regards
  21. Hi, The Xms option sets the initial heap size. Changing this maybe doesn't affect you so you need to change the Xmx option, which is the maximum heap size. Try putting the following: -J-Xms256m -J-Xmx2048m This way the heap size you can use will be 2GB and iReport should be faster. Hope this helps. Best regards, Aitor
  22. Hi, As far as I know this is not possible. I had the same doubt and posted it some months ago but I had no answer: http://community.jaspersoft.com/questions/542219/double-font-size I think the Font class that Jasper uses only accepts integer type sizes, I guess it is not possible what we want. Regards.
  23. Hi, What about this videos? I think it's a good way to start. By the way, here you have a lot of videos about jasper report how-tos: https://www.google.es/webhp?sourceid=chrome-instant&ie=UTF-8#q=jasper+xml+datasource+tutorials&hl=es&prmd=imvns&source=univ&tbm=vid&tbo=u&sa=X&ei=qbL2T4u2H4XP4QSomJzVBg&ved=0CIsBEKsE&fp=1&biw=1440&bih=799&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.,cf.osb&cad=b Hope this helps. Regards. Post Edited by augarte at 07/06/2012 09:47
  24. Hi, Maybe you could use "Ignore pagination" property. It's inside Jasper Report Parameters: http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRParameter.html IS_IGNORE_PAGINATIONstatic final java.lang.String IS_IGNORE_PAGINATION[/code]Whether to use pagination.If set to true the report will be generated on one long page. See Also:Constant Field ValuesThis way, the report won't be paginated and I guess you could print on continuous paper. Hope this helps. Regards.
  25. HI, You can use the following query: select convert(int, DATEDIFF (DAY, BornDat, GETDATE()) / 365.25) from People This will return and integer variable with the age of each row in your table. Hope this helps, Regards.
×
×
  • Create New...