cancel
Showing results for 
Search instead for 
Did you mean: 

RAS API and DatabaseController 's setDataSource to use POJO collection

Former Member
0 Kudos

Is there a newer/different version of the Crystal Reports Java SDK than 2008 V3 ? I want to pass in a collection and export a PDF report at runtime (I'm already able to produce documents with no data).

The jar and api I have doesn't match with usage in sample code.

Specifically, one of the sample JSP's (java_crj12_web_pojo_datasource.jsp which came in the CRJava_POJO_DataSource zip on [the samples page|https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsJava+SDKSamples]) uses DatabaseController like so:

reportClientDocument.getDatabaseController()
        .setDataSource(pojoCollection, Person.class, "Person", "Person");

and yet the jar I have (rasapp.jar) does not have those parameters as a possible option in DatabaseController class. (I can setDataSource() with a ResultSet, IDataSet, IXMLDataSet, or just Object, but no collection+type combo. (but at least the jar I have matches the javadoc api that came in the dev guide).

What am I doing wrong? Or do I just have an old version? Or am I missing some piece? Suggestions?

I have Crystal Reports Server Embedded 2008 V3 (CRSE 2008 Service Pack 3 Full Build)

The running "Report Application Server 12" version is 12.3.0.601 as shown in the Central Configuration Manager

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Just as a follow-up I managed to find a workable solution, but will likely use the ResultSet as it comes from the database since that seems like the more natural way that Crystal Reports "wants" to be interacted with.

I found a nifty list-to-resultset library contained in "Java JRC Desktop Set POJO Datasource.zip" found here: [http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/e0bb2f5e-3e11-2c10-b9b5-855fa4106d84]

The jar included in there is called "pojoSample.jar" and is provided "as-is"

This allowed me to convert my List into a ResultSet

List<Person> peopleList = //my data...
POJOResultSetFactory factory = new POJOResultSetFactory(Person.class);
POJOResultSet resultSet = factory.createResultSet(peopleList);

so then I could use it as my datasource

rcd.getDatabaseController().setDataSource(resultSet,tableAlias,tableAlias);

Since I'm still early in the development I haven't quite decided which will be an easier interaction -- using a Collection or using a ResultSet directly from the database.

Edited by: parks104 on May 26, 2011 5:35 PM

former_member734654
Discoverer
0 Kudos

Do you some how know, where one can download this jar file which contains POJOResultSetFactory class?

(In some forums it says BO XI R2 has it in its installation folder. I am looking for a place to download the file. )

any help will be appreciated,

thanks,

Former Member
0 Kudos

The POJOResultSetFactory class is contained in the file "pojoSample.jar" which is contained in the zip file "Java JRC Desktop Set POJO Datasource.zip" which can be downloaded from [http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/e0bb2f5e-3e11-2c10-b9b5-855fa4106d84]

former_member185028
Active Participant
0 Kudos

Hello.

The sample that you are looking at is from the Crystal Reports For Eclipse (CRJ) samples page. You mentioned that the SDK that you are using is the RAS SDK. I believe that the function that you are talking about is only available in Crystal Reports For Eclipse and not in RAS.

The RAS samples can be found at the following link:

http://wiki.sdn.sap.com/wiki/display/BOBJ/JavaRASSDK+Samples

I hope this helps.

- Robert