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)
Background image based on dataset
Lol-Lefou
Hi all !
I can't find any good way to have this working :
in my report, i want to set up a background image based on the result of a dataset.
My dataset fetchs an information (whether the report's datas are validated or not), and i want to use this information to set a "not valid" background image on my report.
I tried setting a persistent global variable in :
- the onrender event of a dataitem in my masterpage footer
- the oncreate event of the said dataitem
- the onfetch event of my dataset
and using a getPersistentGlobalVariable in my report beforeFactory / beforeRender, with no success.
I used timestamps to track the events order, and it appears that the beforeFactory / beforeRender events of the report are triggered before any other event (even the events of the elements in the masterpage).
Do you have any idea on how to use my dataset to put my background image ?
--
Lionel
Find more posts tagged with
Comments
mwilliams
Hi Lionel,
What does your data look like in your dataSet? This way I can see how you determine what background image you use. Thanks.
Lol-Lefou
Hi mwilliams,
My dataset returns an integer indicating the number of invalid data (ie : select count * as nb from table where valide=0).
In my report, i want to use this information (the number of invalid) to set up my background
if nb > 0
{
masterpage.getStyle().setBackgroundImage("image.jpg")
}
Thanks for your help
mwilliams
Lionel,
What version of BIRT are you using? This way I can attach an example you can run if I get one working. Thanks.
Lol-Lefou
Hi mwilliams,
Sorry for the delay, it was a long day.
I'm using birt version 2.5.0
Thanks for your help
--
Lionel
mwilliams
Lionel,
Here's what I ended up doing:
Create a second master page for your report. Make the background image of each of them different. In your dataSet's onFetch script, grab the value returned by the count function and set it to a variable.
In the first element in your report, check this new variable against 0 and change the master page used depending like below:
if (validCount > 0){
this.getStyle().masterPage = "NewSimpleMasterPage";
}
Hope this helps. Let me know if you have any questions or need an example.
Lol-Lefou
Thanks mwilliams, this can be a useful help !
mwilliams
Lionel,
Glad to help. Let us know whenever you have questions!