File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Java Products and Servers and the fly likes setting runtime selection criteria in a jsp for crystal reports11 using jrc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "setting runtime selection criteria in a jsp for crystal reports11 using jrc" Watch "setting runtime selection criteria in a jsp for crystal reports11 using jrc" New topic
Author

setting runtime selection criteria in a jsp for crystal reports11 using jrc

vidhi majmudar
Greenhorn

Joined: Jun 29, 2007
Posts: 1
We�re presently piloting the JRC packaged with Crystal Reports XI - Release-2.

We wanted to modify the selection formula of the report dynamically.
However, we came to know that presently this feature is only supported with the RAS and that JRC does not support this feature.

Hence, we decided to run the SQL query externally and set the data source for the report dynamically.

Mentioned below is a snippet of the code we�re using for achieving the same:

reportClientDocument.open("jrc_set_resultset_datasource/jrc_set_resultset_datasource.rpt", 0);

/*
* SQL query that can be used can be obtained by first creating a report
* directly off the desired datasource, and then in Crystal Reports, open the
* 'Database' > 'Show SQL Query' to see the SQL generated for the report.
*/
String query = (write a query to display information on the report depending on the selection criteria)

/*
* Call simple utility function that obtains Java Result set that will be
* pushed into the report.
*/
ResultSet resultSet = getResultSetFromQuery(query, ResultSet.TYPE_SCROLL_INSENSITIVE);

String tableName = reportClientDocument.getDatabaseController().getDatabase().getTables().getTable(0).getName();

/*
* Push the Java Resultset into the report. This will then become the
* datasource of the report when the report itself is generated.
*/
reportClientDocument.getDatabaseController().setDataSource(resultSet, tableName , "resultTbl");

This approach works fine if the report has only one table configured. However, when more than one table is configured in the report with joins, it fails to display the report.

The queries we have are as follows:
1.Does JRC support multiple tables in a report with the approach suggested above?
2.If yes,
a.Do we need to specify result sets multiple times for each table in the report? If yes, how?
b.How do we specify the name of all the tables while setting the data source of the report document?
3.Is there any alternative way to set the selection formula of the report dynamically?
Kindly post a solution, its is very urgent.
[ June 29, 2007: Message edited by: vidhi majmudar ]
Antony Zietz
Greenhorn

Joined: Nov 22, 2012
Posts: 1
Hi,

You can modify the selection formula of the report dynamically.

See more in API:

http://help.sap.com/javadocs/boe/xi/ras/en/com/crystaldecisions/sdk/occa/report/application/FilterController.html


Bye!
 
jQuery in Action, 2nd edition
 
subject: setting runtime selection criteria in a jsp for crystal reports11 using jrc