|
Re: Problem with Scripted DataSource and POJOs [message #520292 is a reply to message #520068] |
Thu, 11 March 2010 15:20 |
|
Ivan,
there should be a chapter in the book on scripted dataset. You may also
want to check the dev share at birt-exchange.org. There are a lot of
examples there.
So in your example you could flatten the row like
personname
personsex
personrace
cartype
carmodel
Then use the car iterator to iterate over the rows and just set
personame (noniterative data every row. In most cases you will access
the bean in the beforeOpen and set it to a js var. Just do not use the
var keyword and the Fetch will have access to it.
beforeOpen
this:
mybean = calljavatogetmybean();
cariter = mybean.getCarIterator();
instead of:
var mybean = calljavatogetmybean();
fetch
if(cariter.hasNext() == false ){
return false;
}
var car= iterator.next();
row["personame"] = mybean.getName();
row["carmodel"] = car.getCarModel();
return true;
Jason
Ivan Hoe wrote:
> Hi there again!
>
> I just love BIRT. The thing this time is that I don't know what item
> from the Palette to use to extract info from my JavaBean (It is a custom
> Object used to store iteration of data but also has not iterative info
> to place in the report that looks as a form layout).
>
> The thing is I know (sort of) how to use the Scripted DataSource and
> followed the tutorial of
> http://www.vogella.de/articles/EclipseBIRT/article.html and I know how
> to place info from an Array of objects (in this case a List of DataSets).
>
> My custom DataSet works in almost the same manner but let's say that I
> have a Bean holding as properties the name, age, sex, and so on of a
> fellow, and an iterative property of any number of let's say cars that
> guy owns. How complex do the scripts become with this approach? I know I
> would have a fetch just iterating the "cars names" and just bind that
> iteration with the dataSet in a row["xxx"] maner, but how do I deal with
> the non iterative content?
>
> Guess it sounds a bit more complex than it should. I know most of my
> problem is lack of knowledge but even though I own the 2nd edition of
> the Field Guide to Reporting, no mention to Scripted Datasource is made.
>
> Ivan
|
|
|
Powered by
FUDForum. Page generated in 0.03013 seconds