Skip to main content



      Home
Home » Newcomers » Newcomers » anybody can pl solve this
anybody can pl solve this [message #205719] Wed, 18 April 2007 10:43 Go to next message
Eclipse UserFriend
am trying to run a birt report which uses a DataSource, from stand alone
java class
then am getting the following error


java.lang.NullPointerException

at
org.eclipse.birt.report.model.elements.OdaDataSource.setIntr insicProperty(OdaDataSource.java:201)

at
org.eclipse.birt.report.model.core.DesignElement.setProperty (DesignElement.java:1192)

at
org.eclipse.birt.report.model.core.DesignElement.setProperty (DesignElement.java:1162)

at
org.eclipse.birt.report.model.parser.DesignParseState.setPro perty(DesignParseState.java:99)

at
org.eclipse.birt.report.model.parser.OdaDataSourceState.pars eODADataSourceExtensionID(OdaDataSourceState.java:178)

at
org.eclipse.birt.report.model.parser.OdaDataSourceState.pars eAttrs(OdaDataSourceState.java:82)

at
org.eclipse.birt.report.model.parser.ModuleParserHandler.sta rtElement(ModuleParserHandler.java:167)

at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unk nown Source)

at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanSt artElement(Unknown
Source)

at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragme ntContentDispatcher.dispatch(Unknown
Source)

at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDo cument(Unknown
Source)

at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unk nown Source)

at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)

at
org.eclipse.birt.report.model.parser.ModuleReader.readModule (ModuleReader.java:90)

at
org.eclipse.birt.report.model.parser.DesignReader.read(Desig nReader.java:90)

at
org.eclipse.birt.report.model.core.DesignSession.openDesign( DesignSession.java:278)

at
org.eclipse.birt.report.model.api.SessionHandle.openDesign(S essionHandle.java:291)

at
org.eclipse.birt.report.engine.parser.ReportParser.getDesign Handle(ReportParser.java:161)

at
org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.o penReportDesign(ReportEngineHelper.java:243)

at
org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.o penReportDesign(ReportEngineHelper.java:191)

at
org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.o penReportDesign(ReportEngineHelper.java:125)

at
org.eclipse.birt.report.engine.api.impl.ReportEngine.openRep ortDesign(ReportEngine.java:224)

at programs.FireReport.<init>(FireReport.java:51)

at programs.ExecuteReport.main(ExecuteReport.java:12)
Re: anybody can pl solve this [message #205759 is a reply to message #205719] Wed, 18 April 2007 12:52 Go to previous messageGo to next message
Eclipse UserFriend
I believe you are more likely to get a response in eclipse.birt newsgroup

HTH
Darins

"Lucky" <shaikjaheer@alshaya.com> wrote in message
news:d679309eb591ab026c32259a6d501d90$1@www.eclipse.org...
> am trying to run a birt report which uses a DataSource, from stand alone
> java class
> then am getting the following error
>
>
> java.lang.NullPointerException
>
> at
> org.eclipse.birt.report.model.elements.OdaDataSource.setIntr insicProperty(OdaDataSource.java:201)
>
> at
> org.eclipse.birt.report.model.core.DesignElement.setProperty (DesignElement.java:1192)
>
> at
> org.eclipse.birt.report.model.core.DesignElement.setProperty (DesignElement.java:1162)
>
> at
> org.eclipse.birt.report.model.parser.DesignParseState.setPro perty(DesignParseState.java:99)
>
> at
> org.eclipse.birt.report.model.parser.OdaDataSourceState.pars eODADataSourceExtensionID(OdaDataSourceState.java:178)
>
> at
> org.eclipse.birt.report.model.parser.OdaDataSourceState.pars eAttrs(OdaDataSourceState.java:82)
>
> at
> org.eclipse.birt.report.model.parser.ModuleParserHandler.sta rtElement(ModuleParserHandler.java:167)
>
> at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unk nown
> Source)
>
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanSt artElement(Unknown
> Source)
>
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragme ntContentDispatcher.dispatch(Unknown
> Source)
>
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDo cument(Unknown
> Source)
>
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>
> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unk nown
> Source)
>
> at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
>
> at
> org.eclipse.birt.report.model.parser.ModuleReader.readModule (ModuleReader.java:90)
>
> at
> org.eclipse.birt.report.model.parser.DesignReader.read(Desig nReader.java:90)
>
> at
> org.eclipse.birt.report.model.core.DesignSession.openDesign( DesignSession.java:278)
>
> at
> org.eclipse.birt.report.model.api.SessionHandle.openDesign(S essionHandle.java:291)
>
> at
> org.eclipse.birt.report.engine.parser.ReportParser.getDesign Handle(ReportParser.java:161)
>
> at
> org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.o penReportDesign(ReportEngineHelper.java:243)
>
> at
> org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.o penReportDesign(ReportEngineHelper.java:191)
>
> at
> org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.o penReportDesign(ReportEngineHelper.java:125)
>
> at
> org.eclipse.birt.report.engine.api.impl.ReportEngine.openRep ortDesign(ReportEngine.java:224)
>
> at programs.FireReport.<init>(FireReport.java:51)
>
> at programs.ExecuteReport.main(ExecuteReport.java:12)
>
>
>
Re: anybody can pl solve this [message #205774 is a reply to message #205759] Wed, 18 April 2007 13:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Darin,

Can you post the report?
How do you have BIRT deployed?

Jason

Darin Swanson wrote:
> I believe you are more likely to get a response in eclipse.birt newsgroup
>
> HTH
> Darins
>
> "Lucky" <shaikjaheer@alshaya.com> wrote in message
> news:d679309eb591ab026c32259a6d501d90$1@www.eclipse.org...
>> am trying to run a birt report which uses a DataSource, from stand alone
>> java class
>> then am getting the following error
>>
>>
>> java.lang.NullPointerException
>>
>> at
>> org.eclipse.birt.report.model.elements.OdaDataSource.setIntr insicProperty(OdaDataSource.java:201)
>>
>> at
>> org.eclipse.birt.report.model.core.DesignElement.setProperty (DesignElement.java:1192)
>>
>> at
>> org.eclipse.birt.report.model.core.DesignElement.setProperty (DesignElement.java:1162)
>>
>> at
>> org.eclipse.birt.report.model.parser.DesignParseState.setPro perty(DesignParseState.java:99)
>>
>> at
>> org.eclipse.birt.report.model.parser.OdaDataSourceState.pars eODADataSourceExtensionID(OdaDataSourceState.java:178)
>>
>> at
>> org.eclipse.birt.report.model.parser.OdaDataSourceState.pars eAttrs(OdaDataSourceState.java:82)
>>
>> at
>> org.eclipse.birt.report.model.parser.ModuleParserHandler.sta rtElement(ModuleParserHandler.java:167)
>>
>> at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unk nown
>> Source)
>>
>> at
>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanSt artElement(Unknown
>> Source)
>>
>> at
>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragme ntContentDispatcher.dispatch(Unknown
>> Source)
>>
>> at
>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDo cument(Unknown
>> Source)
>>
>> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>>
>> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>>
>> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>>
>> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>>
>> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unk nown
>> Source)
>>
>> at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
>>
>> at
>> org.eclipse.birt.report.model.parser.ModuleReader.readModule (ModuleReader.java:90)
>>
>> at
>> org.eclipse.birt.report.model.parser.DesignReader.read(Desig nReader.java:90)
>>
>> at
>> org.eclipse.birt.report.model.core.DesignSession.openDesign( DesignSession.java:278)
>>
>> at
>> org.eclipse.birt.report.model.api.SessionHandle.openDesign(S essionHandle.java:291)
>>
>> at
>> org.eclipse.birt.report.engine.parser.ReportParser.getDesign Handle(ReportParser.java:161)
>>
>> at
>> org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.o penReportDesign(ReportEngineHelper.java:243)
>>
>> at
>> org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.o penReportDesign(ReportEngineHelper.java:191)
>>
>> at
>> org.eclipse.birt.report.engine.api.impl.ReportEngineHelper.o penReportDesign(ReportEngineHelper.java:125)
>>
>> at
>> org.eclipse.birt.report.engine.api.impl.ReportEngine.openRep ortDesign(ReportEngine.java:224)
>>
>> at programs.FireReport.<init>(FireReport.java:51)
>>
>> at programs.ExecuteReport.main(ExecuteReport.java:12)
>>
>>
>>
>
>
Re: anybody can pl solve this [message #205985 is a reply to message #205774] Thu, 19 April 2007 02:20 Go to previous messageGo to next message
Eclipse UserFriend
hi,
following am posting the code

if (format.equalsIgnoreCase("html"))
{
//Set Render context to handle url and image locataions
HTMLRenderContext renderContext = new HTMLRenderContext();
renderContext.setImageDirectory("image");
HashMap contextMap = new HashMap();
contextMap.put(
EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, renderContext );
task.setAppContext( contextMap );

//Set rendering options - such as file or stream output,
//output format, whether it is embeddable, etc
HTMLRenderOption options = new HTMLRenderOption();
//options.setOutputStream(System.out);

options.setOutputFileName(path+format+"/"+repName+"_"+currTime+ ".html");
options.setOutputFormat("html");

task.setRenderOption(options);

task.run();
}
Re: anybody can pl solve this [message #206130 is a reply to message #205985] Thu, 19 April 2007 10:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Where are you setting up the Platform? What datasource are you using?

Jason

lucky wrote:
> hi,
> following am posting the code
>
> if (format.equalsIgnoreCase("html"))
> {
> //Set Render context to handle url and image locataions
> HTMLRenderContext renderContext = new HTMLRenderContext();
> renderContext.setImageDirectory("image");
> HashMap contextMap = new HashMap();
> contextMap.put(
> EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, renderContext );
> task.setAppContext( contextMap );
>
> //Set rendering options - such as file or stream output,
> //output format, whether it is embeddable, etc
> HTMLRenderOption options = new HTMLRenderOption();
> //options.setOutputStream(System.out);
>
> options.setOutputFileName(path+format+"/"+repName+"_"+currTime+ ".html");
> options.setOutputFormat("html");
> task.setRenderOption(options);
>
> task.run();
> }
>
Re: anybody can pl solve this [message #206641 is a reply to message #206130] Sun, 22 April 2007 04:44 Go to previous messageGo to next message
Eclipse UserFriend
i tryied in so many times but still am getting the same problem, so
below am giving the complete code

//FireReport.java

package programs;

import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.logging.Level;

import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineConstants;
import org.eclipse.birt.report.engine.api.HTMLRenderContext;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.IGetParameterDefinitionTa sk;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
import org.eclipse.birt.report.engine.api.PDFRenderContext;

public class FireReport
{
public FireReport(String birtHome, String path, String repName, String
format, String paramValue)
{
try
{
Calendar calendar = new GregorianCalendar();

int month = calendar.get(Calendar.MONTH)+1;
String currTime = calendar.get(Calendar.YEAR)+
"-"+month+
"-"+calendar.get(Calendar.DATE)+"_"+
calendar.get(Calendar.HOUR_OF_DAY)+
"."+calendar.get(Calendar.MINUTE)+
"."+calendar.get(Calendar.SECOND);

// Configure the Engine and start the Platform
EngineConfig config = new EngineConfig();
config.setEngineHome(birtHome);

// set log config using ( null, Level ) if you do not want a
log file
config.setLogConfig(path+"logfiles", Level.FINE);
Platform.startup(config);

IReportEngineFactory factory = (IReportEngineFactory)Platform

createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_EN GINE_FACTORY);

IReportEngine engine = factory.createReportEngine(config);

engine.changeLogLevel(Level.FINE);

IReportRunnable design =
engine.openReportDesign(path+repName+".rptdesign");

IGetParameterDefinitionTask paramTask =
engine.createGetParameterDefinitionTask(design);


//Create task to run the report and render the report
IRunAndRenderTask task =
engine.createRunAndRenderTask(design);

if (format.equalsIgnoreCase("html"))
{
//Set Render context to handle url and image locataions
HTMLRenderContext renderContext = new HTMLRenderContext();
renderContext.setImageDirectory("image");
HashMap contextMap = new HashMap();
contextMap.put(
EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, renderContext );
task.setAppContext( contextMap );

//Set rendering options - such as file or stream output,
//output format, whether it is embeddable, etc
HTMLRenderOption options = new HTMLRenderOption();
//options.setOutputStream(System.out);

options.setOutputFileName(path+format+"/"+repName+"_"+currTime+ ".html");
options.setOutputFormat("html");

task.setRenderOption(options);

task.run();
}

if (format.equalsIgnoreCase("pdf"))
{
//Set Render context to handle url and image locataions
PDFRenderContext renderContext = new PDFRenderContext();
renderContext.setFontDirectory("font");
HashMap contextMap = new HashMap();
contextMap.put(
EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, renderContext );
task.setAppContext( contextMap );

//Set rendering options - such as file or stream output,
//output format, whether it is embeddable, etc
HTMLRenderOption options = new HTMLRenderOption();
//options.setOutputStream(System.out);

options.setOutputFileName(path+format+"/"+repName+"_"+currTime+ ".pdf");
options.setOutputFormat("pdf");

task.setRenderOption(options);
task.run();
}
}
catch( Exception ex)
{
//System.out.println(ex.getMessage());
ex.printStackTrace();
}
}
public static void main(String args[])
{
String birtHome = "D:/birtruntime/birt-runtime-2_2_0/ReportEngine";
String path = "D:/Workspace/WebReports/";
String repName = "NewDBSample";
//String format = "html";

new FireReport(birtHome, path, repName, "html","hello");
//new FireReport(birtHome, path, repName, "pdf","hello");
}
}
Re: anybody can pl solve this [message #206759 is a reply to message #206641] Mon, 23 April 2007 04:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

I ran your code and only made minimal changes in the main and the
following in your FireReport

> IReportEngineFactory factory = (IReportEngineFactory)Platform
>
>
createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_EN GINE_FACTORY);
>

To
IReportEngineFactory factory = (IReportEngineFactory)
Platform.createFactoryObject(
IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );

and after the report is executed I close the task, destroy the engine
and shutdown the platform.

task.close();
engine.destroy();
Platform.shutdown();

BTW you are also opening a parameter task. I assume you will use it
later for something different, just remember to close task when finished
with them. You do not need a parameter task to set parameters on a
report though.

After those minimal changes your example worked fine.

Jason



Lucky wrote:
> i tryied in so many times but still am getting the same problem, so
> below am giving the complete code
>
> //FireReport.java
>
> package programs;
>
> import java.util.Calendar;
> import java.util.GregorianCalendar;
> import java.util.HashMap;
> import java.util.logging.Level;
>
> import org.eclipse.birt.core.framework.Platform;
> import org.eclipse.birt.report.engine.api.EngineConfig;
> import org.eclipse.birt.report.engine.api.EngineConstants;
> import org.eclipse.birt.report.engine.api.HTMLRenderContext;
> import org.eclipse.birt.report.engine.api.HTMLRenderOption;
> import org.eclipse.birt.report.engine.api.IGetParameterDefinitionTa sk;
> import org.eclipse.birt.report.engine.api.IReportEngine;
> import org.eclipse.birt.report.engine.api.IReportEngineFactory;
> import org.eclipse.birt.report.engine.api.IReportRunnable;
> import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
> import org.eclipse.birt.report.engine.api.PDFRenderContext;
>
> public class FireReport {
> public FireReport(String birtHome, String path, String repName,
> String format, String paramValue)
> {
> try {
> Calendar calendar = new GregorianCalendar();
>
> int month = calendar.get(Calendar.MONTH)+1;
> String currTime = calendar.get(Calendar.YEAR)+
> "-"+month+
> "-"+calendar.get(Calendar.DATE)+"_"+
> calendar.get(Calendar.HOUR_OF_DAY)+
> "."+calendar.get(Calendar.MINUTE)+
> "."+calendar.get(Calendar.SECOND);
>
> // Configure the Engine and start the Platform
> EngineConfig config = new EngineConfig();
> config.setEngineHome(birtHome);
>
> // set log config using ( null, Level ) if you do not want a
> log file
> config.setLogConfig(path+"logfiles", Level.FINE);
> Platform.startup(config);
>
> IReportEngineFactory factory = (IReportEngineFactory)Platform
>
> createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_EN GINE_FACTORY);
>
> IReportEngine engine = factory.createReportEngine(config);
>
> engine.changeLogLevel(Level.FINE);
>
> IReportRunnable design =
> engine.openReportDesign(path+repName+".rptdesign");
> IGetParameterDefinitionTask paramTask =
> engine.createGetParameterDefinitionTask(design);
> //Create task to run the report and
> render the report
> IRunAndRenderTask task =
> engine.createRunAndRenderTask(design); if
> (format.equalsIgnoreCase("html"))
> {
> //Set Render context to handle url and image locataions
> HTMLRenderContext renderContext = new HTMLRenderContext();
> renderContext.setImageDirectory("image");
> HashMap contextMap = new HashMap();
> contextMap.put(
> EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, renderContext );
> task.setAppContext( contextMap );
>
> //Set rendering options - such as file or stream output,
> //output format, whether it is embeddable, etc
> HTMLRenderOption options = new HTMLRenderOption();
> //options.setOutputStream(System.out);
>
> options.setOutputFileName(path+format+"/"+repName+"_"+currTime+ ".html");
> options.setOutputFormat("html");
> task.setRenderOption(options);
>
> task.run();
> }
> if (format.equalsIgnoreCase("pdf"))
> {
> //Set Render context to handle url and image locataions
> PDFRenderContext renderContext = new PDFRenderContext();
> renderContext.setFontDirectory("font");
> HashMap contextMap = new HashMap();
> contextMap.put(
> EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, renderContext );
> task.setAppContext( contextMap );
>
> //Set rendering options - such as file or stream output,
> //output format, whether it is embeddable, etc
> HTMLRenderOption options = new HTMLRenderOption();
> //options.setOutputStream(System.out);
>
> options.setOutputFileName(path+format+"/"+repName+"_"+currTime+ ".pdf");
> options.setOutputFormat("pdf");
>
> task.setRenderOption(options);
> task.run();
> }
> }
> catch( Exception ex)
> {
> //System.out.println(ex.getMessage());
> ex.printStackTrace();
> }
> }
> public static void main(String args[])
> {
> String birtHome = "D:/birtruntime/birt-runtime-2_2_0/ReportEngine";
> String path = "D:/Workspace/WebReports/";
> String repName = "NewDBSample";
> //String format = "html";
>
> new FireReport(birtHome, path, repName, "html","hello");
> //new FireReport(birtHome, path, repName, "pdf","hello");
> }
> }
>
>
>
Re: anybody can pl solve this [message #206769 is a reply to message #206759] Mon, 23 April 2007 04:33 Go to previous message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

I used M6 and the following report.

Jason

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.12"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.2.0.v20070403 Build &lt;2.2.0.v20070406-0959></property>
<property name="units">in</property>
<property name="comments">Copyright (c) 2006 &lt;&lt;Your Company
Name here>></property>
<html-property name="description">Creates a blank report with no
predefined content.</html-property>
<text-property name="displayName">Blank Report</text-property>
<property name="iconFile">/templates/blank_report.gif</property>
<data-sources>
<oda-data-source
extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Data Source"
id="4">
<text-property name="displayName"></text-property>
<property
name="odaDriverClass">org.eclipse.birt.report.data.oda.sampledb.Driver </property>
<property name="odaURL">jdbc:classicmodels:sampledb</property>
<property name="odaUser">ClassicModels</property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set
extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
name="Data Set" id="5">
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">ORDERNUMBER</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">PRODUCTCODE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">QUANTITYORDERED</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PRICEEACH</property>
<property name="dataType">float</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">ORDERLINENUMBER</property>
<property name="dataType">integer</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">ORDERNUMBER</property>
<property name="nativeName">ORDERNUMBER</property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">PRODUCTCODE</property>
<property name="nativeName">PRODUCTCODE</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">QUANTITYORDERED</property>
<property name="nativeName">QUANTITYORDERED</property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PRICEEACH</property>
<property name="nativeName">PRICEEACH</property>
<property name="dataType">float</property>
<property name="nativeDataType">8</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">ORDERLINENUMBER</property>
<property name="nativeName">ORDERLINENUMBER</property>
<property name="dataType">integer</property>
<property name="nativeDataType">5</property>
</structure>
</list-property>
<property name="queryText">select *
from orderdetails</property>
<xml-property name="designerValues"><![CDATA[<?xml
version="1.0" encoding="UTF-8"?>
<model:DesignValues
xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design"
xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
<Version>1.0</Version>
<design:ResultSets derivedMetaData="true">
<design:resultSetDefinitions>
<design:resultSetColumns>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ORDERNUMBER</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>ORDERNUMBER</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PRODUCTCODE</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>PRODUCTCODE</design:label>
<design:formattingHints>
<design:displaySize>15</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>QUANTITYORDERED</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>QUANTITYORDERED</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PRICEEACH</design:name>
<design:position>4</design:position>
<design:nativeDataTypeCode>8</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>PRICEEACH</design:label>
<design:formattingHints>
<design:displaySize>22</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ORDERLINENUMBER</design:name>
<design:position>5</design:position>
<design:nativeDataTypeCode>5</design:nativeDataTypeCode>
<design:precision>5</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>ORDERLINENUMBER</design:label>
<design:formattingHints>
<design:displaySize>6</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
</oda-data-set>
</data-sets>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<table id="6">
<property name="width">100%</property>
<property name="dataSet">Data Set</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">ORDERNUMBER</property>
<expression
name="expression">dataSetRow["ORDERNUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRODUCTCODE</property>
<expression
name="expression">dataSetRow["PRODUCTCODE"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">QUANTITYORDERED</property>
<expression
name="expression">dataSetRow["QUANTITYORDERED"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRICEEACH</property>
<expression
name="expression">dataSetRow["PRICEEACH"]</expression>
<property name="dataType">float</property>
</structure>
<structure>
<property name="name">ORDERLINENUMBER</property>
<expression
name="expression">dataSetRow["ORDERLINENUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
</list-property>
<column id="35"/>
<column id="36"/>
<column id="37"/>
<column id="38"/>
<column id="39"/>
<header>
<row id="7">
<cell id="8">
<label id="9">
<text-property
name="text">ORDERNUMBER</text-property>
</label>
</cell>
<cell id="10">
<label id="11">
<text-property
name="text">PRODUCTCODE</text-property>
</label>
</cell>
<cell id="12">
<label id="13">
<text-property
name="text">QUANTITYORDERED</text-property>
</label>
</cell>
<cell id="14">
<label id="15">
<text-property
name="text">PRICEEACH</text-property>
</label>
</cell>
<cell id="16">
<label id="17">
<text-property
name="text">ORDERLINENUMBER</text-property>
</label>
</cell>
</row>
</header>
<detail>
<row id="18">
<cell id="19">
<data id="20">
<property
name="resultSetColumn">ORDERNUMBER</property>
</data>
</cell>
<cell id="21">
<data id="22">
<property
name="resultSetColumn">PRODUCTCODE</property>
</data>
</cell>
<cell id="23">
<data id="24">
<property
name="resultSetColumn">QUANTITYORDERED</property>
</data>
</cell>
<cell id="25">
<data id="26">
<property
name="resultSetColumn">PRICEEACH</property>
</data>
</cell>
<cell id="27">
<data id="28">
<property
name="resultSetColumn">ORDERLINENUMBER</property>
</data>
</cell>
</row>
</detail>
<footer>
<row id="29">
<cell id="30"/>
<cell id="31"/>
<cell id="32"/>
<cell id="33"/>
<cell id="34"/>
</row>
</footer>
</table>
</body>
</report>


Jason Weathersby wrote:
> I ran your code and only made minimal changes in the main and the
> following in your FireReport
>
> > IReportEngineFactory factory = (IReportEngineFactory)Platform
> >
> >
> createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_EN GINE_FACTORY);
> >
>
> To
> IReportEngineFactory factory = (IReportEngineFactory)
> Platform.createFactoryObject(
> IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
>
> and after the report is executed I close the task, destroy the engine
> and shutdown the platform.
>
> task.close();
> engine.destroy();
> Platform.shutdown();
>
> BTW you are also opening a parameter task. I assume you will use it
> later for something different, just remember to close task when finished
> with them. You do not need a parameter task to set parameters on a
> report though.
>
> After those minimal changes your example worked fine.
>
> Jason
>
>
>
> Lucky wrote:
>> i tryied in so many times but still am getting the same problem, so
>> below am giving the complete code
>>
>> //FireReport.java
>>
>> package programs;
>>
>> import java.util.Calendar;
>> import java.util.GregorianCalendar;
>> import java.util.HashMap;
>> import java.util.logging.Level;
>>
>> import org.eclipse.birt.core.framework.Platform;
>> import org.eclipse.birt.report.engine.api.EngineConfig;
>> import org.eclipse.birt.report.engine.api.EngineConstants;
>> import org.eclipse.birt.report.engine.api.HTMLRenderContext;
>> import org.eclipse.birt.report.engine.api.HTMLRenderOption;
>> import org.eclipse.birt.report.engine.api.IGetParameterDefinitionTa sk;
>> import org.eclipse.birt.report.engine.api.IReportEngine;
>> import org.eclipse.birt.report.engine.api.IReportEngineFactory;
>> import org.eclipse.birt.report.engine.api.IReportRunnable;
>> import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
>> import org.eclipse.birt.report.engine.api.PDFRenderContext;
>>
>> public class FireReport {
>> public FireReport(String birtHome, String path, String repName,
>> String format, String paramValue)
>> {
>> try {
>> Calendar calendar = new GregorianCalendar();
>> int month = calendar.get(Calendar.MONTH)+1;
>> String currTime = calendar.get(Calendar.YEAR)+
>> "-"+month+
>> "-"+calendar.get(Calendar.DATE)+"_"+
>> calendar.get(Calendar.HOUR_OF_DAY)+
>> "."+calendar.get(Calendar.MINUTE)+
>> "."+calendar.get(Calendar.SECOND);
>> // Configure the Engine and start the Platform
>> EngineConfig config = new EngineConfig();
>> config.setEngineHome(birtHome);
>>
>> // set log config using ( null, Level ) if you do not want
>> a log file
>> config.setLogConfig(path+"logfiles", Level.FINE);
>> Platform.startup(config);
>>
>> IReportEngineFactory factory = (IReportEngineFactory)Platform
>>
>> createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_EN GINE_FACTORY);
>>
>>
>> IReportEngine engine = factory.createReportEngine(config);
>>
>> engine.changeLogLevel(Level.FINE);
>>
>> IReportRunnable design =
>> engine.openReportDesign(path+repName+".rptdesign");
>> IGetParameterDefinitionTask paramTask =
>> engine.createGetParameterDefinitionTask(design);
>> //Create task to run the report and
>> render the report
>> IRunAndRenderTask task =
>> engine.createRunAndRenderTask(design); if
>> (format.equalsIgnoreCase("html"))
>> {
>> //Set Render context to handle url and image locataions
>> HTMLRenderContext renderContext = new HTMLRenderContext();
>> renderContext.setImageDirectory("image");
>> HashMap contextMap = new HashMap();
>> contextMap.put(
>> EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, renderContext );
>> task.setAppContext( contextMap );
>> //Set rendering options - such as file or
>> stream output, //output format, whether it is embeddable, etc
>> HTMLRenderOption options = new HTMLRenderOption();
>> //options.setOutputStream(System.out);
>>
>> options.setOutputFileName(path+format+"/"+repName+"_"+currTime+ ".html");
>> options.setOutputFormat("html");
>> task.setRenderOption(options);
>> task.run();
>> }
>> if (format.equalsIgnoreCase("pdf"))
>> {
>> //Set Render context to handle url and image locataions
>> PDFRenderContext renderContext = new PDFRenderContext();
>> renderContext.setFontDirectory("font");
>> HashMap contextMap = new HashMap();
>> contextMap.put(
>> EngineConstants.APPCONTEXT_HTML_RENDER_CONTEXT, renderContext );
>> task.setAppContext( contextMap );
>> //Set rendering options - such as file or
>> stream output, //output format, whether it is embeddable, etc
>> HTMLRenderOption options = new HTMLRenderOption();
>> //options.setOutputStream(System.out);
>>
>> options.setOutputFileName(path+format+"/"+repName+"_"+currTime+ ".pdf");
>> options.setOutputFormat("pdf");
>>
>> task.setRenderOption(options);
>> task.run();
>> }
>> }
>> catch( Exception ex)
>> {
>> //System.out.println(ex.getMessage());
>> ex.printStackTrace();
>> }
>> }
>> public static void main(String args[])
>> {
>> String birtHome =
>> "D:/birtruntime/birt-runtime-2_2_0/ReportEngine";
>> String path = "D:/Workspace/WebReports/";
>> String repName = "NewDBSample";
>> //String format = "html";
>> new FireReport(birtHome, path, repName, "html","hello");
>> //new FireReport(birtHome, path, repName, "pdf","hello");
>> }
>> }
>>
>>
>>
Previous Topic:All import files being flagged unresolvable
Next Topic:Shared workspace between Windows and Linux
Goto Forum:
  


Current Time: Thu Sep 25 15:23:53 EDT 2025

Powered by FUDForum. Page generated in 0.10289 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top