|
Re: Passing a java object to BIRT report [message #363494 is a reply to message #363491] |
Wed, 25 June 2008 18:00 |
Eclipse User |
|
|
|
Originally posted by: jasonweathersby.alltel.net
Smitha,
You can pass an object in using the application context
If you are using the report engine api just add the object
config = new EngineConfig( );
HashMap hm = config.getAppContext();
hm.put( "myobject", yourobjectinstance);
If you are using the web viewer see:
http://wiki.eclipse.org/Adding_an_Object_to_the_Application_ Context_for_the_Viewer_%28BIRT%29
For connection pooling, BIRT supports a JNDI setting for jdbc connects.
Jason
Smitha R wrote:
> Hello,
>
> I am trying to pass a JAVA object as the data set to the BIRT report.I
> am not sure how to go about doing this though and was hoping someone
> could throw some light on this topic.
>
> Also,I was also wondering if there is a way to make the BIRT report use
> the connections from the connection pool of the J2EE application with
> which it is integrated,instead of the BIRT report creating its own DB
> connection.
>
> Any help/input would be greatly appreciated.
>
> Many thanks.
>
>
|
|
|
|
Re: Passing a java object to BIRT report [message #363499 is a reply to message #363497] |
Wed, 25 June 2008 19:08 |
Eclipse User |
|
|
|
Originally posted by: jasonweathersby.alltel.net
Smitha,
It is difficult to run in designer. BIRT 2.3 added a feature called the
preview extension point that lets you preload an application context
object while in the designer, which should help. Take a look at the new
and notable linked on the main page. Once the object is in the
application context you can set it to a dataset by using a scripted
dataset and get a reference to your object by calling
reportContext.getAppContent("yourobjectname"). Once you have the object
you should be able to call methods on it to create your dataset. As an
example take a look at this report
http://wiki.eclipse.org/Retrieve_Session_information_in_Scri pt_%28BIRT%29
It does not use the appcontext, but gets objects from the session of the
viewer and then uses a scripted dataset to get the values for columns.
Jason
Smitha R wrote:
> Thanks so much for the quick response,Jason.
>
> Could you also please throw some light on how one could manipulate the
> java object and create a report using the Report Designer?For
> example,how does one create the data source and set it to a java object?
>
> Many thanks.
>
|
|
|
|
Re: Passing a java object to BIRT report [message #363533 is a reply to message #363528] |
Thu, 26 June 2008 19:42 |
Eclipse User |
|
|
|
Originally posted by: jasonweathersby.alltel.net
Smitha,
The JNDI setting is in addition to a db url. It will try the JNDI
setting first and if that is unsuccessful the dburl will be used.
Jason
Smitha R wrote:
> Jason,
>
> By JNDI setting,did you mean the setting while creating the Data Source
> in the Report Designer?
>
> When I try to enter the JNDI alone,it throws an error saying that the DB
> url is required.
>
> Many thanks.
>
>
>
|
|
|
Re: Passing a java object to BIRT report [message #363542 is a reply to message #363491] |
Fri, 27 June 2008 00:13 |
Eclipse User |
|
|
|
Originally posted by: johnw.innoventsolutions.com
I wrote an article about doing something similar, serializing java
objects and passing them into reports.
http://digiassn.blogspot.com/2007/12/birt-passing-serialized -objects-as.html
John
Smitha R wrote:
> Hello,
>
> I am trying to pass a JAVA object as the data set to the BIRT report.I
> am not sure how to go about doing this though and was hoping someone
> could throw some light on this topic.
>
> Also,I was also wondering if there is a way to make the BIRT report use
> the connections from the connection pool of the J2EE application with
> which it is integrated,instead of the BIRT report creating its own DB
> connection.
>
> Any help/input would be greatly appreciated.
>
> Many thanks.
>
>
|
|
|
|
Re: Passing a java object to BIRT report [message #363555 is a reply to message #363552] |
Fri, 27 June 2008 15:50 |
Eclipse User |
|
|
|
Originally posted by: jasonweathersby.alltel.net
Smitha,
You can do this with a scripted dataset. Take a look at this example:
http://wiki.eclipse.org/Retrieve_Session_information_in_Scri pt_%28BIRT%29
Jason
Smitha R wrote:
> Jason,sorry if it seems like I am harping on the same issue but this is
> the problem that I am facing:
>
> I have a sql query that returns say an employee id,name and
> address.Instead of writing the query in the Report Designer and creating
> the table,I want to pass an object say an ArrayList which contains the
> records and somehow be able to populate the table.
>
> I got how one passes the object.But after that what?I am unable to
> figure out how to use the ArrayList object to create a table in a report
> and populate it.
>
> Please help!
>
> Many thanks.
>
>
>
|
|
|
|
Re: Passing a java object to BIRT report [message #363558 is a reply to message #363557] |
Fri, 27 June 2008 17:13 |
Eclipse User |
|
|
|
Originally posted by: jasonweathersby.alltel.net
You can call a pojo in many places in birt to get a value, but if you
want to do all the formatting etc with a table it needs to be bound to a
data set. In the example I posted you will see that the java objects
are in session and in the before factory event theses objects are loaded
into maps. The maps are then iterated over in a scripted dataset. The
xml for the report was not modified directly. The script tab was used
to create it.
Jason
Smitha R wrote:
> Jason,
>
> I am afraid I don't quite understand fully well.
>
> I saw the report that was attached with the example and all the
> scripting code that was mentioned on the website was included in the XML
> source of the report.
>
> So if I have to pass my JAVA object,then I have to create a report with
> a Scripted Data Source and then add similar code as the example in the
> XML source of this report?
>
> I would really appreciate your help though my query may sound trivial.
>
> Many thanks.
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03901 seconds