Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Designing Analytics Reports
How to put fixed number of things on a page
Migrateduser
<p>I have a report that outputs clusters (maybe "forms" would be a better term) of 8 lines or so of data - with a 1/2 space between forms. My goal is to have all of the forms have the same spacing relative to the top of the page so that multiple pages can be stacked on top of another and singulated easily with a paper cutter. Right now, the report just plots continuously -- not only failing to align with the top of page but also breaking forms over page breaks. The forms are created with a table. That part was very easy -- all works fine.</p>
<p> </p>
<p>My thought was to use BIRT groups to control the output. I use the "initialize" event to init two variables:</p>
<p> </p>
<p>groupNumber = 1;</p>
<p>tableNumber = 0;</p>
<p> </p>
<p>The tableNumber var is intended to count forms per page (trying 4 in my case) and the groupNumber is the var that would change, signaling BIRT's group logic to start a new group (which I use just for the page break).</p>
<p> </p>
<p>Then, I arbitrarily picked a detail row in the table and added the onCreate event script:</p>
<p> </p>
<p>tableNumber++;</p>
<p>if (tableNumber > 3) {</p>
<p> tableNumber = 0;</p>
<p> groupNumber++</p>
<p>}</p>
<p> </p>
<p>Finally, I use "groupNumber" as the Group By expression in the report design.</p>
<p> </p>
<p>The result is that no grouping occurs. (just one group for all of the forms.) Among other things, I think it's clear that I don't understand variable scoping. If I put "groupNumber" in a dynamic text field, it appears to increment as I would expect (1 1 1 1 2 2 2 2 3 3 3 3, etc.) and I can plot it in a table cell (I don't need that, but it was interesting for debugging). But, those changes are not seen by the Group By. Oddly enough, the Group By is seeing something because if I change the spelling of the variable from groupNumber to, say, groupNumberXXX, I get an exception when the report runs. So, Group By apparently sees a variable definition but is not seeing the value changes.</p>
<p> </p>
<p>I tried playing with reportContext.setGlobalVariable("groupNumber", <some number>) but that didn't seem to have an effect. I also tried grouping by a database record key field -- that caused the grouping to work, except that it would insert a page break after every form. (I just ran that experiment to convince myself that I had the group set up properly).</p>
<p> </p>
<p>So, I am out of ideas. Could anyone answer a couple of questions:</p>
<p> </p>
<ol><li>Is this even a sensible way to solve the problem? It seems like I shouldn't have to resort to JS to do this sort of thing. I would expect my inexperience is causing me to look at this the wrong way.</li>
<li>Can someone suggest a good sort of documentation on this aspect of BIRT -- in particular, the details of the JS environment and scoping and such. I've seen some of the documentation on this site, but it didn't appear to be at a level that could take someone like me (novice) and help me understand more of the interactions inside the engine. (Even if this is a silly way to solve this problem, I would like to understand the product better for other problems I will want to solve some other day.)</li>
</ol><p>Thanks,</p>
<p>Vince</p>
Find more posts tagged with
Comments
There are no comments yet