Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Computing values in BIRT
akshatha_k
Hi,<br />
<br />
I have the data as below:(Please find the attachment)<br />
<br />
I need to compute a column(suppose name it as 'Accleration') from the data above Considering the 'Story Points' column and the value =((current row - avg of previous 2 rows)/avg of previous 2 rows)*100. For the 1st row of 'Acceleration', the previous 2 rows will have the value zero. Therefore the 1st row of the computed column will have the value zero. For the 2nd row of 'Acceleration', the value will be ((3-(5/2))/(5/2))*100. for the 3rd row of 'Acceleration', the value will be ((10-(8/2))/(8/2))*100.<br />
<br />
For Example:<br />
<strong class='bbc'>Story Points Acceleration</strong><br />
<br />
5 0 <br />
<br />
3 ((3-(5/2))/(5/2))*100 <br />
<br />
10 ((10-(8/2))/(8/2))*100
Find more posts tagged with
Comments
mwilliams
What's your BIRT version? I'll make you an example.
akshatha_k
Hi,
My BIRT version is 2.6.1
(Version: 2.6.1.v20100709-7m9f7NFT0z0-Im5IWab4F6
Build id: v20100915-1750)
mwilliams
Try something like this in your float type computed column:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
value1 = reportContext.getPersistentGlobalVariable("value1");
value2 = reportContext.getPersistentGlobalVariable("value2");
output = 0;
if (value1 == null && value2 == null){
reportContext.setPersistentGlobalVariable("value1",row["Story Points"].toString());
output = 0;
}
else if (value2 == null && value1 != null){
reportContext.setPersistentGlobalVariable("value2",value1.toString());
reportContext.setPersistentGlobalVariable("value1",row["Story Points"].toString());
value1 = parseInt(value1);
output = ((row["Story Points"] - (value1 / 2)) / (value1 / 2)) * 100;
}
else{
reportContext.setPersistentGlobalVariable("value2",value1.toString());
reportContext.setPersistentGlobalVariable("value1",row["Story Points"].toString());
value1=parseInt(value1);
value2=parseInt(value2);
output = ((row["Story Points"] - ((value1 + value2) / 2)) / ((value1 + value2) / 2)) * 100;
}
output;
</pre>
<br />
I think this is all correct, for what you're wanting. Let me know.
akshatha_k
Thanks for the solution. It did help me.
But is there any documentation or website sharing the informations like how to build an expression builder, or how to write a script? If so, please let me know. This will help me in using more features of BIRT.
Thanks,
Akshatha
mwilliams
Go here:
http://help.eclipse.org/indigo/index.jsp
and search for BIRT Model API 2.3.0. That's the best info you'll find out there for the documentation. Other than that, searching the forums and devShare or asking questions are going to be your best bet.