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

vattembhaskar

Members
  • Posts

    22
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Security Advisories

Downloads

Posts posted by vattembhaskar

  1. 1.For connection as well as for DataSource
    .......
    write an Java bean class and you must have a factory method in that Bean class
    and this static method should return a Collection of Beans/Array of Beans of type of Current Java Bean[i think you know about Factory class] ...
    and set this bean .class file path under CLASSPATH in your iReport tool and create a connection and follow below  2nd point to get fields..

    2.For Datasource only
    ......
    set this bean .class file path under CLASSPATH in your iReport tool and -> select ReportQuery under Data option
    ->click JavaBeanDataSource button give the complete pakaged path for your class and select your needed fields...
    .....

    *I am also new to this and I did like this way only..and let me know whether it is okay or not and is there any alternative?

  2.  File file = new File("C:/VijayReport/SampWithPara.jrprint");
            JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(file);
            JRTextExporter pdfExporter = new JRTextExporter();
            pdfExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
        pdfExporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,"C:/VijayReport/SampWithPara.txt");
        pdfExporter.setParameter(JRTextExporterParameter.CHARACTER_WIDTH,new Integer(10));
        pdfExporter.setParameter(JRTextExporterParameter.CHARACTER_HEIGHT, new Integer(10));
        System.out.println("Exporting report...");
        pdfExporter.exportReport();
        System.out.println("Done!");

    Go through the above code will be helpful.....

  3. I added the following jar files...but i am getting one more error:

    C:Program FilesJasperSoftiReport-3.0.0libjasperreports-3.0.0.jar;

    C:Program FilesJasperSoftiReport-3.0.0libcommons-digester-1.7.jar;

    C:Program FilesJasperSoftiReport-3.0.0libcommons-collections-3.1.jar;

    C:Program FilesJasperSoftiReport-3.0.0libcommons-logging-1.0.2.jar;

    C:Program FilesJasperSoftiReport-3.0.0libcommons-beanutils-1.7.jar;

    C:Program FilesJasperSoftiReport-3.0.0libitext-1.3.1.jar;

    C:VijayReportmysql-connector-java-5.0.4.jar;

    C:Program FilesJavajdk1.6.0_06libservlet-api-2.3.jar;

    C:Program FilesJasperSoftiReport-3.0.0libjfreechart-1.0.3.jar;

    C:Program FilesJasperSoftiReport-3.0.0libcommons-codec-1.3.jar;

    C:VijayReportThroughDataSourcesjcommon.jar

     

    ERROR IS:

    NoSuchMethod error..at

    org.jfree.ui.RectangleInsets.<init><DDDD>V

     

    why it is?...let me know...thanx for ur reply



    Post Edited by VijayaBhaskar.Vatte Reddy at 03/20/09 13:17



    Post Edited by VijayaBhaskar.Vatte Reddy at 03/20/09 13:18
  4. My source is...

     

    import net.sf.jasperreports.engine.JRDataSource;
    import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
    import net.sf.jasperreports.engine.JREmptyDataSource;
    import java.util.HashMap;
    import java.io.*;
    import net.sf.jasperreports.engine.JRException;
    import net.sf.jasperreports.engine.JasperFillManager;
    import net.sf.jasperreports.engine.JasperCompileManager;
    import net.sf.jasperreports.engine.JasperExportManager;
    import net.sf.jasperreports.engine.JRExporterParameter;
    import net.sf.jasperreports.engine.JasperPrint;
    import net.sf.jasperreports.engine.export.JRTextExporter;
    import net.sf.jasperreports.engine.util.JRLoader;
    import net.sf.jasperreports.engine.export.JRTextExporter;
    import net.sf.jasperreports.engine.export.JRTextExporterParameter;
    import net.sf.jasperreports.engine.export.JRPdfExporter;
    import net.sf.jasperreports.engine.export.JRPdfExporterParameter;
    import java.util.ArrayList;
    import java.util.List;
    import java.sql.*;

    import org.jfree.util.PublicCloneable;


    import java.io.File;

    class ChartDeliver implements Cloneable,Serializable {
    Connection conn;
    public void withParams(String id){

       try{
        //System.out.println("Compiling report...");       

    JasperCompileManager.compileReportToFile("C:/VijayReport/ThroughDataSources/ReportHeader.jrxml");
    JasperCompileManager.compileReportToFile("C:/VijayReport/ThroughDataSources/ChartsSubReport.jrxml");
    JasperCompileManager.compileReportToFile("C:/VijayReport/ThroughDataSources/Charts3.jrxml");
    JasperCompileManager.compileReportToFile("C:/VijayReport/ThroughDataSources/BarChartsSubReport.jrxml");
        JasperCompileManager.compileReportToFile("C:/VijayReport/ThroughDataSources/ChartsJB.jrxml");
        System.out.println("Compilation is Done!");
       

    Long myId=Long.parseLong(id);
    AgreementInfo obj=new AgreementInfo();
    obj.setVarId(myId);
    List<AgreementInfo> obj2=new AgreementInfo().testGetAgreementList();
    JRDataSource jrd=new JRBeanCollectionDataSource(obj2);


            JasperFillManager.fillReportToFile("C:/VijayReport/ThroughDataSources/ChartsJB.jasper","C:/VijayReport/ThroughDataSources/ChartsJB.jrprint", new HashMap(), jrd);
            System.out.println("Filling the report is Done!");
            System.out.println("Started to exprot!");
     
         File file = new File("C:/VijayReport/ThroughDataSources/ChartsJB.jrprint");
            JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(file);
            JRPdfExporter pdfExporter=new JRPdfExporter();
    pdfExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
    pdfExporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,"C:/VijayReport/ThroughDataSources/ChartsJB.pdf");
    System.out.println("Exporting report...");
    pdfExporter.exportReport();
    System.out.println("Done!");

             }
        catch (Exception e){
        System.out.println(e);
        }

        }

     public static void main(String atr[]) throws JRException,FileNotFoundException,SQLException,ClassNotFoundException,IOException{
     new ChartDeliver().withParams(atr[0]);
    }

    }

     

     

    Exception is........

    NoSuchMoethod exception of like this....at

    org.jfreeui.RectangleInsets.<init><DDDD>v

     

     



    Post Edited by VijayaBhaskar.Vatte Reddy at 03/20/09 13:20
  5. Exception in thread "main" java.lang.NoClassDefFoundError: org/jfree/util/Public
    Cloneable
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
    4)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
            at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
            at net.sf.jasperreports.engine.fill.JRFillObjectFactory.visitChart(JRFil
    lObjectFactory.java:715)
            at net.sf.jasperreports.engine.base.JRBaseChart.visit(JRBaseChart.java:6
    05)
            at net.sf.jasperreports.engine.JRAbstractObjectFactory.getVisitResult(JR
    AbstractObjectFactory.java:91)
            at net.sf.jasperreports.engine.fill.JRFillElementGroup.<init>(JRFillElem
    entGroup.java:86)
            at net.sf.jasperreports.engine.fill.JRFillElementContainer.<init>(JRFill
    ElementContainer.java:91)
            at net.sf.jasperreports.engine.fill.JRFillBand.<init>(JRFillBand.java:87
    )
            at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getBand(JRFillOb
    jectFactory.java:518)
            at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.jav
    a:528)
            at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFi
    ller.java:77)
            at net.sf.jasperreports.engine.fill.JRFillSubreport.initSubreportFiller(
    JRFillSubreport.java:384)
            at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JR
    FillSubreport.java:358)
            at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubre
    port.java:259)
            at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFi
    llElementContainer.java:275)
            at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:
    426)
            at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVe
    rticalFiller.java:1380)
            at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVertic
    alFiller.java:692)
            at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRV
    erticalFiller.java:255)
            at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVertic
    alFiller.java:113)
            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(JasperFillMa
    nager.java:601)
            at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(Jasper
    FillManager.java:492)
            at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(Jasper
    FillManager.java:472)
            at ChartDeliver.withParams(ChartDeliver.java:42)
            at ChartDeliver.main(ChartDeliver.java:63)
    Caused by: java.lang.ClassNotFoundException: org.jfree.util.PublicCloneable
            at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
            ... 38 more

  6. i am not sure about ur question perfectly...but if u want to print some information of main report in first page[i think ur's main report data also in detail band] and subreport's information in second page try to increase your detail band height and place your subreport at bottom in detail band according to ur's wish to place....i think this will helpful even litle bit...

  7. Hi friends, i am using a Bean object as my DataSource in that Bean class i took one ArrayList(which refers the result of detail entity i.e other java bean class's result) and i am giving my main BEAN as my DataSource while creating connection in iReport and upto this is okay...I provided  factory  method and all to get connection...and inside that factory method i filled the detail entity bean data through setters and added that result to the main BEAN ArrayList ...upto this is okay.....but the actual problem is here..i am setting the data as static data to the details fields through setters but i want to set the data DYNAMICALLY ...how is it possible?....i.e mainly i want to fill the detail bean's fields with DYNAMICALLY in Main BEAN how is it possible??? please let me know any possible ways ....it's an urgent requirement to me plzzzzz help me in this...any idea will be welcome...

    ex code: i set the data as

    MainJavaClass info = new MainJavaClass();

    SubJavaClass detail = new SubJavaClass();// detail entity
            detail.setScheduleSerial(1);// FROM HERE I WANT TO SET THE DATA AS DYNAMICALLY HOW???????
            detail.setDueDate(new Date());
            detail.setInstallmentAmount(null);
            detail.setReceivedAmount(7031d);
            detail.setPrincipalAmount(2031d);
            detail.setPrincipalAmountReceived(2031d);
            detail.setInterestAmount(5000d);
            detail.setInterestAmountReceived(5000d);
            detail.setBalancePrincipal(1000000d);       
           
            info.getScheduleDetails().add(detail);
           

    Thanx in advance,

    Vijay

  8. Hi to all, while i am generating BAR chart the category axis lables are not in well form i.e they are not directly under the series ...slightly thay are beside to them...plz resolve this,how can i get label as correctly under the figure...

    Thanx in advance,

    Vijay..

    Code:
    <?xml version="1.0" encoding="UTF-8"  ?><!-- Created with iReport - A designer for JasperReports --><!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"><jasperReport		 name="BarChartsSubReport"		 columnCount="1"		 printOrder="Vertical"		 orientation="Portrait"		 pageWidth="595"		 pageHeight="842"		 columnWidth="535"		 columnSpacing="0"		 leftMargin="30"		 rightMargin="30"		 topMargin="20"		 bottomMargin="20"		 whenNoDataType="NoPages"		 isTitleNewPage="false"		 isSummaryNewPage="false">	<property name="ireport.scriptlethandling" value="0" />	<property name="ireport.encoding" value="UTF-8" />	<import value="java.util.*" />	<import value="net.sf.jasperreports.engine.*" />	<import value="net.sf.jasperreports.engine.data.*" />	<field name="accountsOpened" class="java.lang.Long">		<fieldDescription><![CDATA[accountsOpened]]></fieldDescription>	</field>	<field name="month" class="java.lang.String">		<fieldDescription><![CDATA[month]]></fieldDescription>	</field>		<background>			<band height="0"  isSplitAllowed="true" >			</band>		</background>		<title>			<band height="0"  isSplitAllowed="true" >			</band>		</title>		<pageHeader>			<band height="0"  isSplitAllowed="true" >			</band>		</pageHeader>		<columnHeader>			<band height="0"  isSplitAllowed="true" >			</band>		</columnHeader>		<detail>			<band height="0"  isSplitAllowed="true" >			</band>		</detail>		<columnFooter>			<band height="0"  isSplitAllowed="true" >			</band>		</columnFooter>		<pageFooter>			<band height="0"  isSplitAllowed="true" >			</band>		</pageFooter>		<summary>			<band height="411"  isSplitAllowed="true" >				<barChart>					<chart  hyperlinkTarget="Self" >					<reportElement						x="0"						y="97"						width="535"						height="253"						key="element-1"						positionType="Float"/>					<box></box>						<chartLegend textColor="#000000" backgroundColor="#FFFFFF" >					</chartLegend>					</chart>					<categoryDataset>						<dataset >						</dataset>						<categorySeries>							<seriesExpression><![CDATA[$F{month}]]></seriesExpression>							<categoryExpression><![CDATA[$F{month}]]></categoryExpression>							<valueExpression><![CDATA[$F{accountsOpened}]]></valueExpression>				<itemHyperlink >				</itemHyperlink>						</categorySeries>					</categoryDataset>					<barPlot isShowTickMarks="false" >						<plot labelRotation="100.0" />						<categoryAxisFormat>							<axisFormat tickLabelColor="#009999" >							</axisFormat>						</categoryAxisFormat>						<valueAxisFormat>							<axisFormat >							</axisFormat>						</valueAxisFormat>					</barPlot>				</barChart>				<staticText>					<reportElement						x="0"						y="50"						width="358"						height="30"						key="staticText-1"/>					<box></box>					<textElement>						<font pdfFontName="Helvetica-Bold" size="14" isBold="true" isUnderline="true"/>					</textElement>				<text><![CDATA[bar Charts:]]></text>				</staticText>			</band>		</summary></jasperReport>
  9. Hi, i am new to jasperReports and i am trying to compile my own java file which is having the following source code:

    import net.sf.jasperreports.engine.JRException;

    import net.sf.jasperreports.engine.JasperCompileManager;
    public class SampApp{
     public static void main(String atr[])throws JRException{
       try{
            System.out.println("Compiling report...");
            JasperCompileManager.compileReport("C:/Samp.jrxml");
            System.out.println("Done!");
             }
          catch (JRException e){
            e.printStackTrace();
          }
        }
    }

    and i provided my jasperreports-3.0.0.jar file as classpath....inside this jar i found those two classes(JRException,JasperCompileManager)...but is showing the following ERROR:

    SampApp.java:1: package net.sf.jasperreports.engine does not exist
    import net.sf.jasperreports.engine.*;
    ^
    SampApp.java:3: cannot find symbol
    symbol  : class JRException
    location: class SampApp
     public static void main(String atr[])throws JRException{
                                                 ^
    SampApp.java:6: cannot find symbol
    symbol  : variable JasperCompileManager
    location: class SampApp
                    JasperCompileManager.compileReport("C:/Samp.jrxml")

                    ^
    SampApp.java:11: cannot find symbol
    symbol  : class JRException
    location: class SampApp
            catch (JRException e){
                   ^
    4 errors

     

     

    ANY REASON? let me know all ....thanx in advance....

  10. Hi to all,i want a help from u regarding with Ejbql query parameters....how can i supply them to my query

    my query is:

    select l from HospitalEntries l;

    i need to filter this query based on fromDate and uptoDate parameters...so i created two new parameters fromDate and uptoDate

    and filtered my query result as

    select l from HospitalEntries l  where l.entryDate>='$P{fromDate }' and l.entryDate>='$P{uptoDate}'.....and these two parameters are able to prompt at command line...then it is showing ERROR like:

    Error filling print... org.hibernate.QueryParameterException: could not locate named parameter [fromDate]
    java.lang.IllegalArgumentException: org.hibernate.QueryParameterException: could not locate named parameter [fromDate]      at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:176)      at net.sf.jasperreports.engine.query.JRJpaQueryExecuter.createQuery(JRJpaQueryExecuter.java:176)      at net.sf.jasperreports.engine.query.JRJpaQueryExecuter.createDatasource(JRJpaQueryExecuter.java:137)      at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:668)      at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:588)      at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1193)      at net.sf.j

     

    like dat...please help me to resolve this....

    Mainly i want to know how can i pass parameters to an Ejbql query in iReport....

    Thanx ,

     

     

  11. Hi, how can we use velocity macros in our Jrxml? if u have an idea please do help to go through it...(optional)[and i am using JAXB to parse xml with supported Annotations...how can we parse and read the content of jrxml through JAXB?...one more is i found one ERROR while parsing pattern attribute when it is equal to #,##0.00]....i don't know about that much on JAXB parser..if u want to give any suggessions?let me see those...hey,i too don't know which techs are useful to parse JRXML's macros to read the values..

    Thanx in advance,



    Post Edited by VijayaBhaskar.Vatte Reddy at 01/22/09 08:00
  12. Hi to all,i have to create an Ejbql connection for my report's datasource ( Database)...i provided my META-INF folder which contains persistence.xml along with all the needed jar file's absolute paths under classpath entries....but i am facing connection problem....couldn't  find datasource(org.net.HibernateException) Error is showing...can any one help me...

    Thanx in advance,

  13. Hi to all,i have to create an Ejbql connection for my report's datasource ( Database)...i provided my META-INF folder which contains persistence.xml along with all the needed jar file's absolute paths under classpath entries....but i am facing connection problem....couldn't  find datasource(org.net.HibernateException) Error is showing...can any one help me...

    Thanx in advance,

×
×
  • Create New...