Pushing runtime data to a report

Once you have created a report based on a Data Definition file (see Configuring a report based on a Data Definition (TTX) file for details), you can push runtime data to the report.

Note:    The data structure of the runtime data being pushed to a report must match the data structure defined in the Data Definition file. The following example assumes that you have a java.sql.ResultSet object called runtimeResultSet with the appropriate data structure.

To push runtime data to a report:
  1. Create a ReportClientDocument object and open the report.
  2. ReportClientDocument clientDoc = new ReportClientDocument();

    clientDoc.open("RuntimeDataReport.rpt", 0);

  3. Obtain a DatabaseController object from the ReportClientDocument object.
  4. DatabaseController dbCtrl = clientDoc.getDatabaseController ();

  5. Get the database table that you are pushing data into and then push the java.sql.ResultSet data in using the DatabaseController object's setDataSource() method.
  6. Note:    The following code pushes data into the first table. It also assumes that a java.sql.ResultSet object called runtimeResultSet has a structure that matches the first table.

    ITable table = dbCtrl.getDatabase ().getTables ().getTable (0);

    dbCtrl.setDataSource (runtimeResultSet, table.getAlias (), "RuntimeResultSet");

  7. Obtain a ReportSource object from the ReportClientDocument.
  8. IReportSource reportSource = clientDoc.getReportSource ();

  9. Once you have obtained a report source, you should cache it in a session variable.
  10. session.setAttribute ("reportsource",reportSource);

Once you have cached the report source, you can view or export the report.



Business Objects
http://www.businessobjects.com/
Support services
http://www.businessobjects.com/services/support/