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)
Creating a new image on every page
Scottc
Hi,
I am trying to generate a report that has an image in the header of each page. But I want to use a different image on each page. Right now, I have an image object in the header of the master page, and I change the URL based on a report variable in the image's onPrepare script. But it seems that my script is only getting called once, and the first image is showing up on every page. Does anyone know a way around this? I'm using BIRT 4.2.
Thanks,
Scott
Find more posts tagged with
Comments
kclark
Where are you putting your script?
Scottc
Thanks for the quick reply.
I'm putting the script in the onPrepare of the image object in the header of my master page. The script just updates a report variable, which I then reference in the URI of my image. I set the URI of the image using the JavaScript Syntax option to include my report variable.
Thanks,
Scott
kclark
Can you make a report with the sample db and post it on here? How many total images do you have and how many pages do you expect the report to generate? I have a few ideas on how to do this but I'd like to see your report.
Scottc
Sure thing, I've attached a version with the sample db.
My actual report doesn't have a top level table element like this one does, I just included it to force the report on to multiple pages.
The total number of pages in my actual report could be over 100, so I could have over 100 images as well.
Scottc
I've created another sample that shows the same issue without relying on the URI to my local server that no one else can test with.
This one uses static images, and just chooses one based on the report variable. Again it appears that the image's onPrepare script is only being called once, so each page gets the same image.
Clement Wong
Scott,<br />
<br />
It's possible to create a global report variable and increment this counter in <em class='bbc'>onPageEnd </em> of the MasterPage, and have a page variable store the current page number.<br />
<br />
Then, in <em class='bbc'>onRender </em> of the MasterPage, you can access the stored value and change the image accordingly.<br />
<br />
I've attached an sample based on your image names. The line commented is there to illustrate if your filenames were sequential.<br />
<br />
<br />
Regards,<br />
Clement Wong<br />
Actuate Corporation
Scottc
Clement,
Thanks so much, that fixed my issue perfectly!
One question, just so I can better understand how BIRT works. Why do we need both a report variable and a page variable? It seems like we could just increment a page variable and only use that, but I tried and this didn't work. Or alternatively, it seems like we could just refer to a report variable in the image URI, but this doesn't work either. Can you explain why this is?
Thanks,
Scott
Clement Wong
That's good to hear that it worked for you.<br />
<br />
Page variables are evaluated at render time (view) and not at run time. <br />
<br />
More detailed info:<br />
<a class='bbc_url' href='
http://www.eclipse.org/birt/phoenix/project/notable2.5.php#jump_4'>Page
Level Variables and Events</a><br />
<br />
<br />
Regards,<br />
Clement Wong<br />
Actuate Corporation
sabu22
<p>Hi Clement,</p><p> </p><p>I have used this particular code for one of my requirrements.The requirrement is for having different headers for different pages .</p><p>But i am facing an issue while implementing this code. I am able to find different headers only when i am viewing this in the Birt report viewer. When i am viewing this reports in pdf or word it is displaying nothing.</p><p> </p><p>Can you please help.........</p><p> </p><p> </p><p>Thanks.</p>
Clement Wong
<p>Hi Sabu22,</p><p> </p><p>I'm used both Open Source BIRT 3.7.2 and Actuate 11 SP4 Fix1 on the sample report that I attached earlier. In both versions, I am able to view the report with the dynamic images, and also export to PDF and Word without any issues.</p><p> </p><p>Can you please let me know what version you are using? Also, if you can attach or send me your design so that I can take a look at the code you've added.</p><p> </p><p> </p>
sabu22
<p>Hi Clement,</p><p> </p><p>Thanz for the reply, I am using version 4.2.8. I have provided just a dummy report in:</p><p><a data-ipb='nomediaparse' href='
http://www.birt-exchange.org/forum/index.php?/topic/30259-variable-page-number/'>http://www.birt-exchange.org/forum/index.php?/topic/30259-variable-page-number/</a></p><p>You
can look it from there , It is just a dummy report like it i have a lot of static data in my report.</p><p> </p><p> </p><p> </p><p>Thanks....</p>
Donna111
<p>[color=#000000;]HI there[/color]</p><p>[color=#000000;]I think you can [/color]<a data-ipb='nomediaparse' href='
http://www.rasteredge.com/how-to/csharp-imaging/create-new-image/'>[color=#000000;]create
diffirent image[/color]</a>[color=#000000;] on each page using an image program which supports to create all kinds of image.[/color]</p><p>[color=#000000;]That would make your work easily.There are many third party program for image.You can choose the most suitable one for you.[/color]</p>