Jump to content

ak10

Members
  • Posts

    3
  • Joined

  • Last visited

ak10's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. The time I want to display is a DURATION, and it's type is java.lang.time. for example for each name, I would like to display the duration of the call they made. so the size of the slice in the pie chart would be according to the duration of the call the person made. The field is now in format: days hours:min:sec How can I display this in a pie chart? how do I convert the time? what is the best way to do this in order to get the most accurate result?
  2. In my report I have a pie chart in which I want to display data according to a query result that has 2 fields: field_name, field_time. This pie chart should display the time for each name. field_name is of type java.lang.String and field_time is of type java.sql.Time In the pie chart I put ${field_name} as the key expression and ${field_time} as the value expression. when i compile I get an error ( see below). How can I create a pie chart t display this info? Error filling print... Error evaluating expression : Source text : $F{field_time} net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : Source text : $F{call_duration} at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:195) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:589) at net.sf.jasperreports.charts.fill.JRFillPieSeries.evaluate(JRFillPieSeries.java:135) at net.sf.jasperreports.charts.fill.JRFillPieDataset.customEvaluate(JRFillPieDataset.java:216) at net.sf.jasperreports.engine.fill.JRFillElementDataset.evaluate(JRFillElementDataset.java:164) at net.sf.jasperreports.engine.fill.JRCalculator.calculateVariables(JRCalculator.java:158) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:747) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:270) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:946) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247) at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:877) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '05:41:03' with class 'java.sql.Time' to class 'java.lang.Number' at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToNumber(DefaultTypeTransformation.java:139) at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:234) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:602) at Vigilance32Report32Template_1294329035048_573338.evaluate(calculator_Vigilance32Report32Template_1294329035048_573338:292) at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:182) ... 16 more Thanks!
  3. Hi, I am trying to create a dynamic query which uses a parameter. I would like to have the query look like: SELECT tableA.field1, tableA.field2, table A.field3 FROM tableA, tableB WHERE tableA.field3 = 3 and tableA.field4 = tableB.field4 ORDER BY 2 What I would like to do is have the data in red ("tableB" in the FROM clause, and the row: "and tableA.field4 = tableB.field4") be added only if a certain parameter contains a value of x. I added a parameter called REPORT_FIELD4_NAME which has a value of: $P{REPORT_FIELD1}.equals( "x" ) ?: "and tableA.field4 = tableB.field4" : "" meaning that if parameter REPORT_FIELD1 = x then add the row "and tableA.field4 = tableB.field4" to the query. and I added another parameter called REPORT_FIELD4_NAME which has a value of: $P{REPORT_FIELD1}.equals( "x" ) ? ", tableB" : "" and then wrote the query in this format: SELECT tableA.field1, tableA.field2, table A.field3 FROM tableA $P!{REPORT_FIELD4_NAME_TABLE} WHERE tableA.field3 = $P!{REPORT_FIELD4_NAME} ORDER BY 2 but this doesn't work. A few quesitons: 1. Is this the correct way to write a dynamic query? Can I write this in the query designer in the iReports or do I have to enter it manually in the jrxml file? 2. I added the parameters under the Parameters section in the Report Inspector, and they are both input parameters. So when I run the report the user is prompted for input for these parameters. Could this be what is causing the problem? Also, is there a way to make these parameters not for input? 2. Can I use a parmeter in the FROM clause like I did? By the way, when I tried to use a parameter only in the where clause it did not work either. 3. Can I use a partameter in the ORDER BY clause? If so how do I do this? Thanks Post Edited by ak10 at 12/19/2010 15:21
×
×
  • Create New...