Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » 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
Mika Tapanainen is currently offline Mika TapanainenFriend
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 WeathersbyFriend
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 25 01:39:59 GMT 2024

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

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

Back to the top