Home
Analytics
Script for conditional display of i18n text??
BIRT_NEEDY
Hi,<br />
<br />
I am developing a BIRT report that uses XML data source. I pass the path of the XML file as parameter. I need to display a label text (from a i18n resource file) depending on the xml tag attribute value. The XML tag attribute value is not displayed in the report, but is only checked for it's content. <br />
<br />
The attribute value is captured as data set in the report.<br />
<br />
I am using the following java script in the onPrepare event of the label to be displayed<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
var check="";
if (BirtComp.equalTo( dataSetRow["RUN"], "Trial")){
check = dataSetRow["RUN"];
}
return check;
</pre>
<br />
I am getting the following error<br />
There are erros evaluating the script......<the above code>!!!!!!!!!<br />
<br />
Is this the right way to display a label text on conditional basis? If not please let me know the actual/right way.<br />
<br />
Any help will be appreciated.<br />
Thanks
Find more posts tagged with
Comments
BIRT_NEEDY
Hi,<br />
<br />
I am unable to access the data set value in the onPrepare method of the label!! the code is <br />
<strong class='bbc'>this.text=dataSetRow["RUN"];</strong><br />
<br />
I have done the binding in the binding editor.<br />
<br />
I am getting the following error!!<br />
org.eclipse.birt.report.engine.api.EngineException: There are errors evaluating script "this.text = dataSetRow["RUN"];":<br />
<br />
ReferenceError: "<em class='bbc'><strong class='bbc'>dataSetRow</strong></em>" is not defined. (/report/body/grid[
@id="
;32"]/row[
@id="
;36"]/cell[
@id="
;37"]/label[
@id="
;261"]/method[
@name="
;onPrepare"]#8)<br />
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1166)<br />
at org.eclipse.birt.report.engine.api.impl.ScriptedDesignHandler.handleOnPrepare(ScriptedDesignHandler.java:124)<br />
at org.eclipse.birt.report.engine.api.impl.ScriptedDesignVisitor.visitLabel(ScriptedDesignVisitor.java:270)<br />
<br />
Any help will be appreciated.<br />
Thanks