Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Comparing data columns from the same data series
Darcy
I have a report containing a cross tab. Within this cross tab I want the Actual column to take a background colour based on its comparison with the Previous Year column. I have tried using highlights but they will not work because both Actual, Previous Year and some other data comparisons are contained within the same data field. My data set is using Information Objects from Views. Actuate have told me that I can do this through scripting, however, they have not told me how! Can anyone help?
Find more posts tagged with
Comments
mwilliams
Hi Darcy,
If I'm understanding correctly, you should be able to use persistentGlobalVariables that you name using the row dimension value. You can then store the current value in this PGV and in the next column, you can access this, now previous, column and compare the values. I think there might be an example in the devShare that I've made for this before. I'm not sure if I put it in there though. I'll take a look. If neither you or I finds it, let me know if the above makes sense or if you need an example.
Darcy
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="71416" data-time="1292434213" data-date="15 December 2010 - 10:30 AM"><p>
Hi Darcy,<br />
<br />
If I'm understanding correctly, you should be able to use persistentGlobalVariables that you name using the row dimension value. You can then store the current value in this PGV and in the next column, you can access this, now previous, column and compare the values. I think there might be an example in the devShare that I've made for this before. I'm not sure if I put it in there though. I'll take a look. If neither you or I finds it, let me know if the above makes sense or if you need an example.<br /></p></blockquote>
Darcy
Hi Michael
I've found something in DevShare entitled "BIRT Function Difference Functionality", is this the one? If it is I think the script in it is a bit above my capability!!! I am not SQL trained and do not understand most of it - I was hoping there would be a simple script to achieve what I want to do! What you've said about the PGVs sort of makes sense although I've never heard of them before, so if you have any idiot proof examples that would be great!
Thanks
mwilliams
It was a different one than that, but similar. It was a "highlight differently when value goes up or down" example. I at least posted it in a thread if I didn't put it in the devShare. I'll take a look and see if I still have it. If not, I'll make something up real quick. The script could essentially just be copied and pasted into your report with the field names changed.
mwilliams
Darcy,
What is your BIRT version? I'll just make a quick example for you. Then, I'll post it to the devShare for others to search!
Darcy
Hi Michael
Sorry for not replying sooner, I have been out of the office. We are using BIRT Version 2.3.2, I look forward to the example.
Thanks a lot.
mwilliams
Take a look at the attached example. It can probably be cleaned up a little as I just threw this together, but it should get you started.
Let me know if you have questions.
Darcy
Hi Michael
Thanks for doing the script for me. Unfortunately I know nothing about XML so I need to get our IT Dept to adapt it to work with our database and my report. This will probably take a while but I will let you know if it works!
mwilliams
This code should work independent of what type of database/dataSet you have. It only works with the dimensions and measures of the crosstab that have been defined within BIRT, so you should be able to use code that looks almost exactly like mine only with your dimension/measure fields subbed into the code.
Darcy
Let me check I've got this right. I don't need to change the database or dataset name as it will pick this up from the report?
However, I need to change the measure fields. Are these the lines beginning with <property name="columnName" or "displayName" etc. (Basically, either COUNTRY, PAYMENTDATE OR AMOUNT)? If this is correct, do these three measures all get pulled into the report by the same data field?
Sorry to ask so many questions but this code may as well be written in Greek for all the sense it makes to me!!!
Thanks
mwilliams
For the dimensions, you should just be able to replace the field names that I used with the field names that you have. For the measure, if you need help building the grouping name, you can drop a dynamic textbox into your crosstab cell and then open the available bindings tree and add the measure to the expression by double clicking on it. You can then copy and paste this into the measure name area of the code and delete the unneeded dynamic textbox.
If you have any troubles setting this up, let me know. You can attach your design in here and I'll try to put the code in for you the right way. Or, if you just want to send it off to your IT dept, that will work too!
Darcy
Hi Michael
I was going to send you the report design and let you put the script in for me, however, I am unable to upload it for some reason.
mwilliams
You can always email it to me at mwilliams@birt-exchange.com. Not sure what issue you're having with the upload, but email will work fine too!