Home
Analytics
[HOW] : Dynamically change the Label values
dalepraneeth
How to dynamically change the Label values through java code.
For example there is Label named: X has a value="Morning"
Now i need Label X to change it's value to "Evening"
All from a java code.
There can be any number of labels each having a unique name.
And javascript code could be helpful.
Find more posts tagged with
Comments
mwilliams
I'm pretty sure I responded to you over on the Eclipse newsgroup, but it's down, today. You should be able to do something like:
designHandle.findElement("LabelX").setText("Evening");
dalepraneeth
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="114090" data-time="1360430901" data-date="09 February 2013 - 10:28 AM"><p>
I'm pretty sure I responded to you over on the Eclipse newsgroup, but it's down, today. You should be able to do something like:<br />
<br />
designHandle.findElement("LabelX").setText("Evening");<br /></p></blockquote>
<br />
There is no method <strong class='bbc'>setText</strong><br />
<br />
....<br />
<br />
IReportRunnable design = birtEngine.openReportDesign(filestr);<br />
ReportDesignHandle report = (ReportDesignHandle) design.getDesignHandle( );<br />
try {<br />
report.findElement("LabelX").getPropertyHandle("content").setStringValue("Evening");<br />
} catch (SemanticException e) {<br />
// TODO Auto-generated catch block<br />
e.printStackTrace();<br />
}<br />
<br />
<strong class='bbc'>do you think the above can work ???</strong>
mwilliams
setText is there, in the java doc, for a label.
You could try importing org.eclipse.birt.report.model.api to make sure it's available for your use. What is the error that using setText gives you?
Does the code you posted above work, when you try it?
dalepraneeth
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="114432" data-time="1361464383" data-date="21 February 2013 - 09:33 AM"><p>
setText is there, in the java doc, for a label.<br />
<br />
You could try importing org.eclipse.birt.report.model.api to make sure it's available for your use. What is the error that using setText gives you?<br />
<br />
Does the code you posted above work, when you try it?<br /></p></blockquote>
<br />
IReportRunnable design = birtEngine.openReportDesign(filestr);<br />
<strong class='bbc'>IReportDesign </strong>report = design.getDesignInstance( );<br />
try {<br />
report.getLabel("LabelX").setText("Evening");<br />
} catch (SemanticException e) {<br />
// TODO Auto-generated catch block<br />
e.printStackTrace();<br />
}<br />
<br />
This worked too .... did you suggest the same ??? But i have <strong class='bbc'>Date </strong>to be changed <strong class='bbc'>which is not a label</strong> ... how to change that one ???
dalepraneeth
I am getting this exception, but after i recycle my JVM ... BIRT would work again.<br />
I had implemented BIRT engine as singleton.<br />
<br />
<strong class='bbc'>org.eclipse.birt.report.engine.api.EngineException</strong>: Error happened while running the report.<br />
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:196)<br />
Caused by: java.lang.NullPointerException<br />
at <strong class='bbc'>org.eclipse.birt.report.engine.data.dte.ReportQueryBuilder$QueryBuilderVisitor.createParamBindings</strong>(ReportQueryBuilder.java:1670)<br />
<br />
<br />
What could be the reasons ??
mwilliams
Can you try running separate run and render tasks to see if the issue goes away?
dalepraneeth
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="115207" data-time="1363722104" data-date="19 March 2013 - 12:41 PM"><p>
Can you try running separate run and render tasks to see if the issue goes away?<br /></p></blockquote>
<br />
could you please provide me with samples.
dalepraneeth
This is another post i created for these exceptions :
http://www.birt-exchange.org/org/forum/index.php/topic/29028-engineexception/