Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Designing Analytics Reports
API automatically creates broken binding
Migrateduser
Hey All,<br />
<br />
I have been working generating my own reports for a while.<br />
I've got everything set up, there is only one problem remaining.<br />
<br />
I have got a binding that i want to use in a hide expression, but when i add the hiderule, the api seems to automatically generate a new binding for my binding, and it assumes my initial binding is a dataset member.<br />
<br />
I have a lot of other bindings already working, so I assume there is no problem there.<br />
<br />
I use the following code to generate the hide expression.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
public void hideElement(DesignElementHandle handle, String expression) throws SemanticException {
if (handle == null || expression == null) return;
HideRule hr = StructureFactory.createHideRule();
PropertyHandle ph = handle.getPropertyHandle(IReportItemModel.VISIBILITY_PROP);
if (ph != null) {
ph.clearValue();
HideRuleHandle hrHandle = (HideRuleHandle) ph.addItem(hr);
hrHandle.setFormat(DesignChoiceConstants.FORMAT_TYPE_ALL);
//hrHandle.setProperty(HideRule.VALUE_EXPR_MEMBER, expression);
hrHandle.setExpressionProperty(HideRule.VALUE_EXPR_MEMBER, new Expression(expression, "javascript"));
}
}
</pre>
<br />
which results in the following xml entry, which looks great (I use it to hide a label)<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<label name="element128" id="573">
<list-property name="visibility">
<structure>
<property name="format">all</property>
<expression name="valueExpr" type="javascript">row["element127"]==null</expression>
</structure>
</list-property>
<text-property name="text" key="allReports.type.DRIVE_STOP">allReports.type.DRIVE_STOP</text-property>
</label>
</pre>
<br />
And now the weird part, this seems to come out of nowhere<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<structure>
<property name="name">element127_1</property>
<expression name="expression">dataSetRow["element127"]</expression>
<simple-property-list name="aggregateOn">
<value>unitGroup</value>
</simple-property-list>
</structure>
</pre>
<br />
As you see, my hide expression is "row["element127"]==null" and somehow, the API sees the "element127", when I add my hiderule, creates a binding for it, and refers to my binding using "dataSetRow" ... Why does it do that ?<br />
<br />
Because of that, i get the following error:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
org.eclipse.birt.report.engine.api.EngineException: Column binding "element127_1" has referred to a data set column "element127" which does not exist. (Element ID:10)
</pre>
<br />
Edit:<br />
Useful to know maybe, the automatically generated binding looks a lot like the binding it refers to<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<structure>
<property name="name">element127</property>
<expression name="expression">reportContext.getMessage("allReports.type.DRIVE_STOP")</expression>
<simple-property-list name="aggregateOn">
<value>unitGroup</value>
</simple-property-list>
<property name="aggregateFunction">count</property>
</structure>
</pre>
<br />
<br />
<br />
Can someone tell me why binding "element127_1" is created ? And how i can avoid it from being created ?<br />
<br />
Thank you very much !
Find more posts tagged with
Comments
There are no comments yet