Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » The setting of the XML data source file in the java code
The setting of the XML data source file in the java code [message #556435] Wed, 01 September 2010 10:54 Go to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 55
Registered: July 2010
Member
Hello,

how to set the XML data source file in the java code?

The XML data source file is possible to set in the design time, but is it possible to set from the java code?

BR,

Mika
Re: The setting of the XML data source file in the java code [message #556483 is a reply to message #556435] Wed, 01 September 2010 13:05 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

You can set the xml datasource location a couple of different ways.

1 use property binding expression. This is done in the datasource
editor. Just select the property binding tab and set the expression to
something like:

importPackage( Packages.java.io );
importPackage( Packages.javax.servlet.http );
if(
reportContext.getHttpServletRequest().getAttribute("attributeBean ").isDesigner()
){
"C:\\xfer\\company.xml";
}else{
var rp =
reportContext.getHttpServletRequest().getSession().getServle tContext().getRealPath( "/Report");
"file:///"+rp+"/company.xml";
}

2 set it in the beforeOpen script(this can be written in Java or JavaScript)

In JavaScript you would enter:
this.setExtensionProperty("FILELIST", "locationtomyxmlfile");
If you implemented the event handler in Java it would look like:
public void beforeOpen(IDataSourceInstance dataSource,
IReportContext reportContext) throws ScriptException {
dataSource.setExtensionProperty("FILELIST", "locationtomyxmlfile");
}

Jason

On 9/1/2010 6:54 AM, mika.tapanainen@digia.com wrote:
> Hello,
>
> how to set the XML data source file in the java code?
>
> The XML data source file is possible to set in the design time, but is
> it possible to set from the java code?
>
> BR,
>
> Mika
Previous Topic:change size of the grid's case
Next Topic:Manage multiple resource/language files?
Goto Forum:
  


Current Time: Wed Sep 17 07:36:25 GMT 2014

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

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