How to set a value of a variable into a table cell?
<p>Hello everyone!!<br><br>
I'm newbie using BIRT and I have a question for all of you experts!!<br><br>
I've created a table with 4 columns "A","B","C" and "D", column "D" is empty, I mean, no data, aggregation or text is in there whilst "A", "B" and "C" have an element from Data Set related to them.<br><br>
I'm trying to set a value from "A" into the column "D" through a script only if "B" and "C" meet a condition. This is the script (written over Cell "D"):<br><br>
cB = this.getRowData().getColumnValue("B");<br>
cC = this.getRowData().getColumnValue("C");<br><br>
if ((cB== 0) && (cC==1))<br>
{<br>
vA = this.getRowData().getColumnValue("A");<br>
<br>
}<br><br>
As you can see I was able to write the condition and get the value from "A" if that condition is true, but I don't know how to set the value of "vA" variable into the cell "D".<br><br>
I hope you can help me.<br><br>
Thanks in advance.</p>
I'm newbie using BIRT and I have a question for all of you experts!!<br><br>
I've created a table with 4 columns "A","B","C" and "D", column "D" is empty, I mean, no data, aggregation or text is in there whilst "A", "B" and "C" have an element from Data Set related to them.<br><br>
I'm trying to set a value from "A" into the column "D" through a script only if "B" and "C" meet a condition. This is the script (written over Cell "D"):<br><br>
cB = this.getRowData().getColumnValue("B");<br>
cC = this.getRowData().getColumnValue("C");<br><br>
if ((cB== 0) && (cC==1))<br>
{<br>
vA = this.getRowData().getColumnValue("A");<br>
<br>
}<br><br>
As you can see I was able to write the condition and get the value from "A" if that condition is true, but I don't know how to set the value of "vA" variable into the cell "D".<br><br>
I hope you can help me.<br><br>
Thanks in advance.</p>
0
Comments
-
<p>Hi dap, if I understand the question correctly then you should be able to set a persistent global variable and then reuse it in your other column. I haven't tested this but using your example it should look something similar to this</p>
<pre class="_prettyXprint _lang-">
cB = this.getRowData().getColumnValue("B");
cC = this.getRowData().getColumnValue("C");
if ((cB== 0) && (cC==1))
{
vA = this.getRowData().getColumnValue("A");
reportContext.setPersistentGlobalVariable("vA", va);
}
</pre>
<p>Then, assuming the cell you want to add the value into is a label, you could use something like this, though it should be similar with a data element</p>
<pre class="_prettyXprint _lang-">
this.text = reportContext.getPersistentGlobalVariable("vA");
</pre>Warning No formatter is installed for the format ipb0 -
<blockquote class="ipsBlockquote" data-author="kclark" data-cid="143837" data-time="1463076091">
<div>
<p> </p>
<p>Hi dap, if I understand the question correctly then you should be able to set a persistent global variable and then reuse it in your other column. I haven't tested this but using your example it should look something similar to this</p>
<pre class="_prettyXprint _lang-">
cB = this.getRowData().getColumnValue("B");
cC = this.getRowData().getColumnValue("C");
if ((cB== 0) && (cC==1))
{
vA = this.getRowData().getColumnValue("A");
reportContext.setPersistentGlobalVariable("vA", va);
}
</pre>
<p>Then, assuming the cell you want to add the value into is a label, you could use something like this, though it should be similar with a data element</p>
<pre class="_prettyXprint _lang-">
this.text = reportContext.getPersistentGlobalVariable("vA");
</pre>
</div>
</blockquote>
<p> </p>
<p> </p>
<p>Hi kclark,</p>
<p> </p>
<p>Thanks for your help!!, I was able to display the value into the "D" cell but, correct me if I'm wrong, the displayed value is a string type, right?. If so, how can I convert the String value to a Time value so that I can take it to make some maths with it?????</p>
<p> </p>
<p>Regards.</p>0 -
<p>Or you can create a new binding for Column D. You will be able to create an expression, and do the tests you need and return the appropriate data type that you need.</p>
Warning No formatter is installed for the format ipb0
Categories
- All Categories
- 108 Developer Announcements
- 53 Articles
- 106 General Questions
- 145 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 899 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 120 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management