Skip to main content



      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 06:54 Go to next message
Eclipse UserFriend
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 09:05 Go to previous message
Eclipse UserFriend
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: Tue Jul 22 17:47:27 EDT 2025

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

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

Back to the top