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)
Evaluating BIRT - dynamic columns within sub report
Manglesh
Hello All,
We are in process of evaluating reporting tools for our upcoming project. BIRT is one of the candidate that we see as promising tool that meets many of our requirements.
We are unable to find the solution to one of our requirement - that is to show table columns dynamically within detail report based on the outer record from master table.
Here is what we want to achieve -
We show list of services offered by the company. Lets call it Service 1, Service 2 etc.. For each of these services, we want to show the discounts offered at different locations
call it loc1, loc2 etc.. the locations at where discounts are offered is dependent on each service. So Service 1 may have locations of loc1 and loc2 only while service 2
may have discounts for loc1, loc3 and loc4. The layout will looks something like below :
Service 1
Weight Loc1 Loc2
1-10 10% 20%
11-50 20% 30%
Service 2
Weight Loc1 Loc3 Loc4
1-10 10% 20% 30%
11-50 20% 30% 40%
We are planning to use Scripted data source which will use Java Domain objects to provide the data for the same. We envision this to have master detail relationship where master table will
show list of services and detail table will show discounts for each of the services. The problem is that we dont know how to create dynamic columns within the detail subreport based on
the given service. We looked at implementing TableEventAdapter for detail report but the only method that has referece to updating table layout is onPrepare() and that is called only once and not for each
outer row. while onCreate() and onRender() is called for each row of the outer table, but they dont have any reference to object that will allow creating columns dynamically.
Any sample code or the pointer to the solution will be greatly appreciated. This would determine if we can go with BIRT as majority of our tables require this kind of relationship.
Thanks a lot.
Manglesh
Find more posts tagged with
Comments
mwilliams
Hi Manglesh,
At first glance, I think you should be able to handle this with a crosstab. It may depend on how your data is set up though. If you can attach a sample of data and show in here what you want that sample to look like in your report, I can see if I can put together a quick example.
Manglesh
Thanks for your response.
Attached is the test source code along with the pdf output (outputresamplePricingProposal_JavaEvents.pdf). As you can see, PricingProposal is the domain object used to feed the data to the data set. This contains list of PricingServiceGroup (Service 1, Service 2 etc.. ). Each PricingServiceGroup contains list of PricingServiceGroupDiscount object that contains weight breaks and the percentage discount. Current report design is static where fixed number of columns are in sub report ( lower, upper and discount ), but we intend to have this dynamic number of columns where discount column may be multiple based on Service.
TestReport.java is the main class that will initialize the PricingProposal object and execute the report.
Please let me know if you need more details.
Thanks a lot
Manglesh
mwilliams
Manglesh,
Sorry, I probably didn't explain well enough what I was looking for. If you could just create a .csv file of how your data is in your dataSet in your report, that'd be the easiest way for me to create a quick example to post in here. Thanks.
Manglesh
Sorry Michael, I think I misunderstood what you were looking for. Attached is the sample data. Master shows the list of services and Detail shows the discount for each services. As you can see, discounts for different locations are stored as rows in the table, but we want to show them as columns for each service. So with that data, output would look like below :
Service_1
lower Upper Loc1 Loc2
1 10 10 20
11 50 20 30
Service_2
lower Upper Loc1 Loc3 Loc4
1 10 10 20 30
11 50 20 30 40
Please let me know if you need more information.
Thanks for looking into this.
Thanks !!
Manglesh
mwilliams
Manglesh,
What version of BIRT are you using so I can work on this in your version?
Manglesh
Hi,
I am using BIRT 2.3.1
Thanks !!
Manglesh
mwilliams
Manglesh,
Take a look at this example. This was just a simple design to give you an idea on how to do this. Let me know if you have any questions.
Manglesh
Thanks Michael. This is what I wanted. I will just have to use scripted data sets as thats what we would be implementing with. I will post if i have any questions.
Thanks a bunch for your help.
Thanks !!
Manglesh
mwilliams
No problem. Glad I could help.
Cornelius
Hi<br />
<br />
I have a similar requirement but can not seem to download the example DiscountDetail.zip??? When I click on the DiscountDetail.zip file it just prompts me to login even though I am logged in?<br />
<br />
please email me the sample?<br />
<br />
Thanks, <br />
<br />
<a href='mailto:' title='E-mail Link' class='bbc_email'>ckloppers@gmail.com</a>
mwilliams
Hi Cornelius,
I have sent you the file in email. Let me know if you have any issues.