This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: setting runtime selection criteria in a jsp for crystal reports11 using jrc
 
Similar Threads
Crystal Reports on J2EE (Weblogic)
Java Bean Connectivity , EJB, JSP and .NET client dilemma
Windward Java Engine Review
JRC - multiple tables in crystal report
Java and Crystal Reports XI: Dynamic Changing of Data Source