Home
Analytics
set xml Property Binding programmatically in Java
jf1
Hi,
I am designing reports programmatically in java. Now I want to add for a 'xml data source connection' a 'property Binding' (see attachment:
Find more posts tagged with
Comments
jf1
I have found a workaround for me: I do everything in the beforeOpen-method of the datasource.
JanaF
If someone else got a similar problem and the workaround is not satisfied, I just found the correct way to set it programmatically in Java:<br />
<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>OdaDataSourceHandle dsHandle = designFactory.newOdaDataSource("Data Source", org.eclipse.datatools.enablement.oda.xml");
dsHandle.setPropertyBinding("FILELIST", new Expression(dynamicDataSourceString, null));
</pre>
<br />
dynamicDataSourceString is the String which should be added in the xml here (after "<expression name="value" type="value">"):<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.20" id="1">
<property name="createdBy">Eclipse BIRT Designer Version 2.5.1.v20090903 Build <2.5.1.v20090917-1447></property>
<property name="units">in</property>
<list-property name="propertyBindings">
<structure>
<property name="name">FILELIST</property>
<property name="id">373</property>
<expression name="value">temp = java.lang.System.getenv("CX_REPORT_DATA");var reportFolderAndReportName = reportContext.getReportRunnable().getReportName();var tempvar = reportFolderAndReportName.substr(reportFolderAndReportName.lastIndexOf('/'));var tempvar1 = tempvar.substr(0, tempvar.lastIndexOf("."));var reportname = tempvar1.replace(/%20/g, " ");FILELIST = temp+reportname+".xml";</expression>
</structure>
</list-property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="bidiLayoutOrientation">ltr</property>
<parameters>
</pre>