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

Pollux Us

Members
  • Posts

    3
  • Joined

  • Last visited

Pollux Us'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. Hi I try to use groovy for my report to connect a subdataset to an Oracle database. -> In report > properties> language : i selected groovy -> in my dataset i choose "use an other connection" with the expression : Sql.newInstance( "jdbc:oracle:thin:@ip:1521:XE", "user", "pw", "oracle.jdbc.driver.OracleDriver" )[/code]When i preview the report i get this following error : net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : Source text : Sql.newInstance( "jdbc:oracle:thin:@ip:1521:XE", "user", "pw", "oracle.jdbc.driver.OracleDriver" ) at com.jaspersoft.studio.editor.preview.view.control.ReportControler.fillReport(ReportControler.java:466) at com.jaspersoft.studio.editor.preview.view.control.ReportControler.access$18(ReportControler.java:441) at com.jaspersoft.studio.editor.preview.view.control.ReportControler$4.run(ReportControler.java:333) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)Caused by: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : Source text : Sql.newInstance( "jdbc:oracle:thin:@ip:1521:XE", "user", "pw", "oracle.jdbc.driver.OracleDriver" ) at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:263) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:611) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:579) at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:1016) at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:392) at net.sf.jasperreports.components.table.fill.FillTableSubreport.evaluateSubreport(FillTableSubreport.java:92) at net.sf.jasperreports.components.table.fill.FillTable.evaluate(FillTable.java:118) at net.sf.jasperreports.engine.fill.JRFillComponentElement.evaluate(JRFillComponentElement.java:110) at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:259) at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:456) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2067) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:788) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:298) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:152) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:963) at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFiller.run(BaseFillHandle.java:120) at java.lang.Thread.run(Unknown Source)Caused by: groovy.lang.MissingPropertyException: No such property: Sql for class: reportFacturation_1406640568882_851084 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50) at org.codehaus.groovy.runtime.callsite.GetEffectivePogoPropertySite.getProperty(GetEffectivePogoPropertySite.java:86) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231) at reportFacturation_1406640568882_851084.evaluate(calculator_reportFacturation_1406640568882_851084:263) at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:250) ... 16 more[/code] Can someone helps me to solve this problem ? Thanks. PS : I use jaspersoft studio 5.6 version of groovy : 2.3.6 JDK : 1.7
  2. Hi, I found how to do this, if someone is interested, but i'm not sure it's the best way. In my java code i created a TreeMap<Date,List<BigDecimal>> I initialized this TreeMap by the Date i want with a list of 0 for each product : (Date)List(0) <=> product 1List(1) <=> product 2List(2) <=> product 3List(3) <=> product 402-July-2014000001-july-20140000then i created jdbc connection and i executed all my requests from my java code : Request 1 : SELECT SUM(price), the_dateFROM SALEWHERE id_product = 1AND the_date > TO_DATE('31/05/2014', 'DD/MM/YYYY')AND the_date < TO_DATE('03/07/2014', 'DD/MM/YYYY')GROUP BY the_date</pre>[/code]Request 2 : SELECT SUM(price), the_dateFROM SALEWHERE id_product = 2AND the_date > TO_DATE('31/05/2014', 'DD/MM/YYYY')AND the_date < TO_DATE('03/07/2014', 'DD/MM/YYYY')GROUP BY the_date[/code]Request 3 : SELECT SUM(price), the_dateFROM SALEWHERE id_product = 3AND the_date > TO_DATE('31/05/2014', 'DD/MM/YYYY')AND the_date < TO_DATE('03/07/2014', 'DD/MM/YYYY')GROUP BY the_date[/code] Request 4 : SELECT SUM(price), the_dateFROM SALEWHERE id_product = 4AND the_date > TO_DATE('31/05/2014', 'DD/MM/YYYY')AND the_date < TO_DATE('03/07/2014', 'DD/MM/YYYY')GROUP BY the_date[/code] then i got the results and filled my TreeMap : (Date)List(0) <=> product 1List(1) <=> product 2List(2) <=> product 3List(3) <=> product 402-July-20141000180001-july-2014150200060With this TreeMap i created an array of bean, then a JRDataSource, i passed my JRDataSource to my report in my java code and it's works. Like i said before i'm think it's not the best solution, if someone have a better solution i would like to know what it is :)
  3. Hi, I'm new to JasperReports, here is my problem : I have one table SALE with three columns price [bigDecimal], id_product [integer], the_date [Date]. My query : SELECT sum(price), the_dateFROM SALEWHERE id_product = $P{my_parameter}GROUP BY the_date[/code]The query works, but i want to get four datasets (one for each case of my_parameter). I would like to build a lineChart with 4 lines. For each line : Category : $F{the_date}Value : $F{sum(price)}Series : $P{key_parameter} Line 1 => Query 1 => my_parameter = 1Line 2 => Query 2 => my_parameter = 2Line 3 => Query 3 => my_parameter = 3Line 4 => Query 4 => my_parameter = 4 I want the four line in the same time on my chart (At the moment i just get one line). Is this possible ? If this is possible can u explain me how to do this please ? Thanks for help in advance ! PS : I apologise for my rought english.
×
×
  • Create New...