Crystal reports XI java how to pass many pojo objects from jsp to CR issue.

Posted on 2007-10-12
Last Modified: 2009-12-16
I'm using Crystal Report XI for Java, and in my sample I'm using one Pojo dataset and it works ok, but I would like to know how to pass more than one pojo object to a same report result. ( like having two simple separate tables.)
This is a little peace of code inside the JSP:

String reportName = "submitedContracts.rpt";
ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);, OpenReportOptions._openAsReadOnly);
 // Populate POJO data source
 String className = "org.tempuri.FDCInformation.FDCInformationSrv.SubmittedContractsBE";
 List dataset = new ArrayList();
 dataset = (List)request.getAttribute("dataSet");
 JRCHelperSample.passPOJO(clientDoc, dataset, className, tableAlias, "");

IReportSource reportSource = clientDoc.getReportSource();
JRCHelperSample.exportPDF(reportSource, request, response, config.getServletContext(), true);

above example just send one Object to crystal report . Do you know how to send more than one object on above code example..? passPOJO just accept one object and I tried to below line after fill my second data set:
 JRCHelperSample.passPOJO(clientDoc, dataset2, className2, tableAlias2, ""); but does not work,

passPOJO method:

public static void passPOJO(ReportClientDocument clientDoc, Collection dataSet,
                  String className, String tableName, String reportName) throws ReportSDKException,ClassNotFoundException{
                  clientDoc.getDatabaseController().setDataSource(dataSet, Class.forName(className),tableName,tableName+"_POJO");
                  clientDoc.getSubreportController().getSubreport(reportName).getDatabaseController().setDataSource(dataSet, Class.forName(className),tableName,tableName+"_POJO");

Thank's in advance.
Question by:rsamayoab
    LVL 100

    Expert Comment

    Crystal can only work with a single data source unless you use subreports.

    To use multiple tables simply create a dataset by joining the tables and passing the joined dataset to the report

    Select, T2.Address
    FROM T1 Inner join T2 on T1.Id =


    Author Comment

    May I can pass a Map object that contain multiple sub objects and manipulate inside Crystal Reports , do you know if it is posible? . I tried with sub report and it work ok but I would like to have two bean objects
    to be treated as tables and show this two objects in the same report. My report will have one grid to show information (dataset1 ) and a chart  (dataset1 ). I do not need more than one datasource, just one datasource with multiple datasets objects.

    thank's in advance.
    LVL 100

    Accepted Solution

    Crystal wants a single dataset for the report.  TO use multiple datasets you need to join them or use subreports.

    In this case youwill need 2 subreports.

    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
    After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now