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)
Combine Data from Multiple Data Sources
jasons
Hello,
I have a grid that has three rows and two columns:
A1 A2
B1 B2
C1 C2
A2, B2 and C2 are dynamic text report items.
B2 and C2 each reference a different data set, which uses a different data source.
I then have a table below the grid that references a data set from yet another data source.
I need A2 to be the summation of the values from three places:
1. B2
2. C2
3. The summation of one of the columns (shown in footer) of table
Thank you for your time and I look forward to hearing back from you.
Jason
Find more posts tagged with
Comments
mwilliams
Hi Jason,
So, B2 and C2 reference a single value from separate sources and then there is a table from a 3rd source that has a total value from a column that you want to sum with B2 and C2 and display in A2? Is this correct?
jasons
Correct:
A2 = B2 + C2 + (sum of column in table)
B2, C2 and the table with the sum are all working fine. I just need to sum the three values together.
mwilliams
If you put something like this in your initialize script of your report:
temp = 0;
Then, put something like this in the onCreate of B2, C2, and the total aggregation element of the table:
temp = temp + this.getValue();
Finally, in the onRender of a dynamic text element in A2 area, put the following:
this.text = temp.toString();
The script might be slightly different than that, that's just the general idea off the top of my head.
Let me know if you run into issues.
jasons
I have attempted multiple variations of this and it is still not working.
My guess is that A2 is evaluated and assigned a value before I am able to reassign/update temp with the values from B2, C2 and the total aggregation element of my table.
Currently, the value for A2 will just be 0 from the implementation of your solution above.
To test this, I did not initialize temp in the "initialize" script of my report.
Rather, I created temp in cell B2, which appears to be evaluated after A2.
Same as prior: "temp=0"
When I did this, A2 was blank.
How can I tell BIRT to assign the value of A2 as the very last thing it does for the report.
Else, what would be another solution? Thank you for your time.
mwilliams
And you assigned the value to the dynamic text box in its onRender script? If so, did you only test this in preview mode? If so, try it in the web viewer instead. If not, can you try this with the sample database and attach what you have that's not working and I'll take a look.
jasons
Appears I have solved the issue:
I added the data calls at the top of my report and set their visibility to hidden.
I set the results of B2, C2 and the aggregation to report variables.
I then use these in the report and to calculate A2, as the values are created prior to assigning A2.
mwilliams
Great! Glad to hear you got it working. Let us know whenever you have questions!