Skip to main content



      Home
Home » Archived » BIRT » Importing java objects into report
Importing java objects into report [message #261006] Fri, 09 November 2007 08:44 Go to next message
Eclipse UserFriend
Originally posted by: abelo.telecable.es

Hello,

is there any way of injecting java objects (or collections) into a report?

For example, I have a table of people in my report with columns:

| Name | Address | Email | Phone Number |
----------------------------------------

And I have a java class like this:

class Person {
private String name;
private String address;
private String email;

....

Can I import a java.util.List<Person> into the report to build the
table, or I have to setup a scripted dataset?

Thanks in advance.
Re: Importing java objects into report [message #261009 is a reply to message #261006] Fri, 09 November 2007 10:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Abel,

You can inject any Java object into the report through the appcontext or
as a session object. If you want to iterate over it you will still need
a table or list and most likely a scripted data set. Just because it is
a scripted data set does not mean that it can not use already created
objects.

Take a look at this example:
http://wiki.eclipse.org/Retrieve_Session_information_in_Scri pt_%28BIRT%29

Jason

Abel Pastur wrote:
> Hello,
>
> is there any way of injecting java objects (or collections) into a report?
>
> For example, I have a table of people in my report with columns:
>
> | Name | Address | Email | Phone Number |
> ----------------------------------------
>
> And I have a java class like this:
>
> class Person {
> private String name;
> private String address;
> private String email;
>
> ...
>
> Can I import a java.util.List<Person> into the report to build the
> table, or I have to setup a scripted dataset?
>
> Thanks in advance.
Re: Importing java objects into report [message #261409 is a reply to message #261006] Wed, 14 November 2007 10:29 Go to previous messageGo to next message
Eclipse UserFriend
Abel,

There is an example of this in the API examples. To get directions on how
to get to the examples go to:

http://www.birt-exchange.com/modules/wfdownloads/singlefile. php?cid=5&lid=206

Take a look a the AddScriptObject example in the reapi package.

Scott Rosenbaum

> Hello,
>
> is there any way of injecting java objects (or collections) into a
> report?
>
> For example, I have a table of people in my report with columns:
>
> | Name | Address | Email | Phone Number |
> ----------------------------------------
> And I have a java class like this:
>
> class Person {
> private String name;
> private String address;
> private String email;
> ...
>
> Can I import a java.util.List<Person> into the report to build the
> table, or I have to setup a scripted dataset?
>
> Thanks in advance.
>
Re: Importing java objects into report [message #263085 is a reply to message #261409] Tue, 11 December 2007 12:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: andrew.bytheway.gmail.com

I am looking for a way to generate a report based on the values contained
in a collection of Java objects. For example:

Class Data{
int height = 3;
int width = 54;
int depth = 19;
}

Height Width Depth
------ ----- -----
3 54 19

Simple. Right?

I've followed some leads in this newsgroup that suggest that this is
possible, but so far, I have not been successful.

Can anyone post code showing how to do this?

Thanks in advance,

Andrew Bytheway
Re: Importing java objects into report [message #263088 is a reply to message #263085] Tue, 11 December 2007 14:48 Go to previous message
Eclipse UserFriend
Originally posted by: johnw.innoventsolutions.com

Andrew,

I wrote a few articles on how to do something similar using scripted
data sets:

Scripted Data Set to call a Web Service
http://digiassn.blogspot.com/2006/10/birt-scripted-data-sour ce-to-call-web.html

Scripted Data Set Serialized POJOS
http://digiassn.blogspot.com/2007/12/birt-passing-serialized -objects-as.html

If you are gnerating those objects on the fly, you can use a regular
scripted data set. If you are generating them in another program, you
can either serialize them like shown in the second example, or feed them
into BIRT using some sort of IPC mechanism.

John

Andrew Bytheway wrote:
> I am looking for a way to generate a report based on the values
> contained in a collection of Java objects. For example:
>
> Class Data{
> int height = 3;
> int width = 54;
> int depth = 19;
> }
>
> Height Width Depth
> ------ ----- -----
> 3 54 19
>
> Simple. Right?
>
> I've followed some leads in this newsgroup that suggest that this is
> possible, but so far, I have not been successful.
>
> Can anyone post code showing how to do this?
>
> Thanks in advance,
>
> Andrew Bytheway
>
Previous Topic:workspace cannot be locked
Next Topic:Birt in a java application
Goto Forum:
  


Current Time: Sat Jun 07 13:33:15 EDT 2025

Powered by FUDForum. Page generated in 0.04257 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top