store values in a Data Set to another [message #671921] |
Thu, 19 May 2011 07:19  |
Eclipse User |
|
|
|
Hello,
Following the instructions from Jason in a previous post, I am conducting a series of tests to store values in a Data Set to another. I am having a problem to calculate the following ratio. I give you an example:
1. Data Set1: This dataset includes an aggregation (count) of Several items on a aggregate group (by product). Example:
product1 - 3
product2 - 2
product3 - 1
2. Data Set2: This Data Set should make another similar to the previous aggregation grouped by product. Example:
product1 - 3
product2 - 2
product3 - 2
3. My goal is to calculate the "Data Set2" the following percentages grouped also by product:
product1: 3 / 3 = 100%
product2: 2 / 2 = 100%
product3: 1 / 2 = 50%
For this, I tried to store the variables of "Data Set1" by scripting as follows:
<method name="onCreate"> <! [CDATA [reportContext.setGlobalVariable (total1 "this.getValue ());]]></ method>
name="resultSetColumn"> <property total_DataSet1 </ property>
Then I inserted a "Data" with the following expression that seeks to calculate the percentage above mentioned:
(reportContext.getGlobalVariable ("total1) / row [" total_DataSet2 "]) * 100
Instead, the Report gives the following result:
product1: 1 / 3 = 33.33%
product2: 1 / 2 = 50%
product3: 1 / 2 = 50%
From which it follows that BiRT is only storing just one variable (the third result or "Data Set1: 1).
Can you tell me how I can store these 3 variables in the example in the "Data Set2? Where is the problem? Does aggregation introduced in the "Data Set 2 " or scripting?
Thanks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.32048 seconds