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

bob007

Members
  • Posts

    18
  • 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

Posts posted by bob007

  1.  

    Hi,

     

    I'm making my reports programmatically with JasperDesign.

    I use JasperCompileManager to compile my reports then I use JasperRunManager.runReportToPdf  to export PDF report. (always by using streams)

    Unfortunately, JasperRunManager seem only exporting in PDF and HTML.

     

    How can I export in other formats ?

     

    Thank you,

    Philippe

     

  2. Hi,

     

    I make my reports programmatically and I got this exception on compilation with JasperReports  BUT when I export my report in .jrxml to try it with IReports its working (with a queryString).

    The error seem to occur because the compiler try to cast my report variable ($V{totalPriorite}) from Integer to String.

     

    What can cause this error ?

     

    I join the output .jrxml.

     

    Thank you,

    Philippe

     

     

    MY ERROR:

    _________________________________________________________________

     

    net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:

    1. Cannot cast from Integer to String

                    value = (java.lang.String)(((java.lang.Integer)variable_totalPriorite.getValue())); //$JR_EXPR_ID=18$

                            <------------------------------------------------------------------------>

    2. Cannot cast from Integer to String

                    value = (java.lang.String)(((java.lang.Integer)variable_totalPriorite.getOldValue())); //$JR_EXPR_ID=18$

                            <--------------------------------------------------------------------------->

    3. Cannot cast from Integer to String

                    value = (java.lang.String)(((java.lang.Integer)variable_totalPriorite.getEstimatedValue())); //$JR_EXPR_ID=18$

                            <--------------------------------------------------------------------------------->

    3 errors

     

                at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:195)

                at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:219)

                at JasperReportChartConstructor.compileReport(JasperReportChartConstructor.java:319)

                ...

     

     

    JAVA: ADDING THE VARIABLE

    _______________________________________________

     

           JRDesignVariable variable = new JRDesignVariable();

          variable.setName("totalPriorite");

          variable.setResetType(JRDesignVariable.RESET_TYPE_GROUP);

          variable.setResetGroup(group);

          variable.setValueClass(java.lang.Integer.class);

          variable.setCalculation(JRDesignVariable.CALCULATION_COUNT);

          JRDesignExpression variableExpression = new JRDesignExpression();

          variableExpression.setValueClass(java.lang.String.class);

          variableExpression.setText("$F{priorite}");

          JRDesignExpression initialValueExpression = new JRDesignExpression();

          initialValueExpression.setValueClass(java.lang.Integer.class);

          initialValueExpression.setText("new java.lang.Integer(0)");

          variable.setExpression(variableExpression);

          variable.setInitialValueExpression(initialValueExpression);

         

             try {

             jasperDesign.addVariable(variable);

          } catch (JRException e) {

             // TODO Auto-generated catch block

             e.printStackTrace();

          }

     



    Post Edited by bob007 at 04/22/2009 20:58
  3.  

    Hi,

     

    I'm making my reports programmaticly with JasperDesign.

    Unfortunatly, I can't find any example about making a chart  report programmaticly ?

    Is there any example about that ?

     

    Like how to set the keyExpression and the valueExpression ?

     

    Thanks,

    Philippe

     



    Post Edited by bob007 at 04/20/2009 19:25
  4.  

    Hi,

     

    I have the same problem.

    I create my reports programmaticly and it don't seem to work to set a textfield to bold.

    by:  textFieldEven.setBold(true);

     

    Did you find a solution about that ?

    Else Is there any other simple way to do it ?

     

    thanks,

    Philippe

  5.  

     

    Hi, i tried that and it didnt work. with the value parameter  value: bondetravail_noBon.

     

       <parameter name="fieldNameParameter" class="java.lang.String">

          <defaultValueExpression><![CDATA[]]></defaultValueExpression>

       </parameter>

    ...

     

    <field name="bondetravail_noBon" class="java.lang.String"/>

     

     

    ...

     

     

       <group name="groupe">

          <groupExpression><![CDATA[$P{REPORT_SCRIPTLET}.getFieldValue( $P{fieldNameParameter} )]]></groupExpression>

          <groupHeader>

             <band height="31">

                <textField isBlankWhenNull="true">

                   <reportElement x="1" y="11" width="187" height="20"/>

                   <textElement>

                      <font size="14" isBold="true"/>

                   </textElement>

                   <textFieldExpression class="java.lang.String"><![CDATA[$P{REPORT_SCRIPTLET}.getFieldValue( $P{fieldNameParameter} )]]></textFieldExpression>

                </textField>

             </band>

          </groupHeader>

          <groupFooter>

             <band height="26"/>

          </groupFooter>

       </group>

     

     

  6. I  tested with parameters values:
    - bondetravail_groupe
    - $F{bondetravail_groupe}
    - <![CDATA[$F{bondetravail_groupe}]]>

    The grouping are not working with the specified parameter.
    The textField display (in result) the string exactly like the parameter string (ex: $F{bondetravail_groupe} ) not like the value of specified field.


    So I guess the only way to modify the report is doing it programmaticly.  To build my report with JasperDesign.


    I don't want to have a template (.jasper) for each grouping possibilities.

  7.  

    Hi all,

     

    I'm new with JasperReports, and I'm asking myself if there any way to set by parameter the field to use for a group ? And I have the same question for a textField.

     

    I will always have the same fields but I want to be able to change the grouping and one textfield specifying the field by parameter.

     

    Is it doable ?

     

    Or I have to change it programmatically when the .jxml if precompiled ? Then what is the best way to change a small part of the .jxml like that ?

     

     

    Thanks,

    Phil

  8.  

    Hi all,

    I'm totally new with jasperReports and i'm trying to a first easy report, but i get this error and i really don't know why.


    My errors:
    List size: 34
    org.zkoss.zk.ui.UiException: net.sf.jasperreports.engine.JRException: Error retrieving field value from bean :
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
     at org.zkoss.lang.Classes.newInstance(Classes.java:78)
     at org.zkoss.lang.Exceptions.wrap(Exceptions.java:164)
     at org.zkoss.zk.ui.UiException$Aide.wrap(UiException.java:46)
     at org.zkoss.zkex.zul.Jasperreport.doReport(Jasperreport.java:513)
     at org.zkoss.zkex.zul.Jasperreport.access$100(Jasperreport.java:76)
     at org.zkoss.zkex.zul.Jasperreport$ExtraCtrl.getMedia(Jasperreport.java:310)
     at org.zkoss.zk.au.http.AuDynaMediar.process(AuDynaMediar.java:112)
     at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:362)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
     at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
     at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
     at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
     at java.lang.Thread.run(Thread.java:619)
    Caused by: net.sf.jasperreports.engine.JRException: Error retrieving field value from bean :
     at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:127)
     at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getFieldValue(JRAbstractBeanDataSource.java:100)
     at net.sf.jasperreports.engine.data.JRBeanCollectionDataSource.getFieldValue(JRBeanCollectionDataSource.java:104)
     at net.sf.jasperreports.engine.fill.JRFillDataset.setOldValues(JRFillDataset.java:787)
     at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:751)
     at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:1422)
     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:111)
     at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:879)
     at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:801)
     at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89)
     at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)
     at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:582)
     at org.zkoss.zkex.zul.Jasperreport.doReport(Jasperreport.java:361)
     ... 20 more
    Caused by: java.lang.NoSuchMethodException: Unknown property '' on class 'class bonDeTravails.BonDeTravailDTO'
     at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1313)
     at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:762)
     at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:837)
     at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:426)
     at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:115)
     ... 32 more
    2009-04-06 16:18:13 org.zkoss.zk.au.http.AuDynaMediar process:130
    GRAVE: Failed to load media, /view/g8dm1/z_8d_l/0/rpt/test_miniRapport.pdf
    >>org.zkoss.zk.ui.UiException: net.sf.jasperreports.engine.JRException: Error retrieving field value from bean :
    >>net.sf.jasperreports.engine.JRException: Error retrieving field value from bean :
    >>java.lang.NoSuchMethodException: Unknown property '' on class 'class bonDeTravails.BonDeTravailDTO'
    >> at org.apache.commons.beanutils.PropertyUtilsBean.getSimpleProperty(PropertyUtilsBean.java:1313)
    >> at org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:762)
    >> at org.apache.commons.beanutils.PropertyUtilsBean.getProperty(PropertyUtilsBean.java:837)
    >> at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:426)
    >> at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:115)
    >> at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getFieldValue(JRAbstractBeanDataSource.java:100)
    >>...[/code]

     --------------------------------------------------------------------------------------------------------------------------

    test_miniRapport.jrxml (only field the fields declaration part)
     <field name="noBon" class="java.lang.String">
      <fieldDescription><![CDATA[]]></fieldDescription>
     </field>
     <field name="statut" class="java.lang.String">
      <fieldDescription><![CDATA[]]></fieldDescription>
     </field>
     <field name="type" class="java.lang.String">
      <fieldDescription><![CDATA[]]></fieldDescription>
     </field>
     <field name="priorite" class="java.lang.String">
      <fieldDescription><![CDATA[]]></fieldDescription>
     </field>
     

     --------------------------------------------------------------------------------------------------------------------------

    My Pojo:
    package bonDeTravails;

    public class BonDeTravailDTO {
     
     private String noBon;
     private String statut;
     private String priorite;
     private String type;  
     
     
     public BonDeTravailDTO() {
      
     }

     public String getNoBon() {
      return noBon;
     }

     public void setNoBon(String noBon) {
      this.noBon = noBon;
     }

     public String getStatut() {
      return statut;
     }

     public void setStatut(String statut) {
      this.statut = statut;
     }

     public String getPriorite() {
      return priorite;
     }

     public void setPriorite(String priorite) {
      this.priorite = priorite;
     }

     public String getType() {
      return type;
     }

     public void setType(String type) {
      this.type = type;
     } 
    }
     

  9. Hi,

     

    I had the same problem as vmustafa when trying to use Hibernate Connection ("Cannot open connection") and i tried your solution.

    "Place the driver .jar in the ext folder of your JDK"

     

    Now i got a new message error :

    "No data type for node : org.hibernate.hql.ast.IdentNode -[iDENT] IdentNode 'adress' {originalText=adress}"

    ITS VERY ODD because I don't have any adress in my hibernate mapping...

    I see some other peoples on the forum with a similar problem but no solution to it ...

     

    What can i do about it ?

    Is iReport really suppose to work with hibernate connection ?

     

    thanks,

     



     



    Post Edited by Philippe Yelle at 04/06/09 14:48
  10.  

    Hi all,

    I'm totally new with JasperReports,

    I'm searching how to declare a field for a bean attribute of a bean ?

     

    Example :

    If I have I bean Person and this bean have a bean attribute car.

    public class Person {

       private String name;

       private int age;

       private Car car;

       …

    }

    Private class Car {

      private String dealer;

      …

    }

     

    How to declare/access dealer ? Can I declare it like that ?

    <field name="car.dealer" class="java.lang.String">

    <fieldDescription><![CDATA[dealer]]></fieldDescription>

    </field>

     

    And access it like that ?

    $F{car.dealer}

     

    Thanks,

    Phil

     

×
×
  • Create New...