|
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 |
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.48453 seconds