There are two implementations of the Ad Hoc Reporting client available
This chapter describes the most common usages of the Ad Hoc Reporting clients.
Using Ad Hoc Reporting as a module in the remote interface of i-net Clear Reports is one of it's primary modes of operation. Simply enable the remote interface and the Ad Hoc Reporting in the configuration manager of your server. For further details how to set up the configuration have a look at chapter Configuration.
The Ad Hoc Reporting module of the Remote Interface can be embedded into an existing website. The embedded mode hides the global toolbar of the Remote Interface to ensure that only the module content is visible.
Due to the necessary HTML content, an iframe must be used. The following code is an example for embedding the module that runs on a server "host" with the application context "context".
<iframe src="http://host/context/adhoc/?embedded=true" width="800" height="600"></iframe>
If authentication is activated at the i-net Clear Reports server, it is possible to use the "Guest Account" feature. This will log in any user with the configured account name. So the user does not need to enter a user name and password but is logged in with an account that's rights can be administrated.
The Swing client of Ad Hoc Reporting is based on a JPanel which can easily be embedded into any Java Swing application.
You can choose to either use the client with report viewer, which is represented by the class com.inet.adhoc.client.AHClient
or use only the pure wizard component, which is com.inet.adhoc.client.AHWizard
.
Using the client with report viewer is an "out of the box" solution with one limitation: the class AHClient
has no function to return the generated Engine or report programmatically. It's intended to only serve as report generator for the user.
To use the AHClient
, simply instantiate the class with the URL to you server and add it to the component tree of your Java Swing application.
AHClient client = new AHClient( serverURL, ahHelpProvider );
The parameter AHHelpProvider
can be set to null
. In that case the client will try to resolve the help pages by the serverURL
and open the pages in the default browser.
The AHWizard
only contains the ad hoc report generation pages. It does not contain a render component like the Swing report viewer of the AHClient. On the other hand, it's more customizable since you can modify it's configuration and set custom request handlers to connect to multiple servers at once.
Since the request handlers can be accessed, you've got the ability to request the generated engine from the server by sending the following request.
IResponse response = requestHandler.handleRequest( request, false ); XMLSerializableByteArray engineData = (XMLSerializableByteArray)response.getProperties().get( AHConstants.KEY_ENGINE_DATA ); if( engineData != null ){ return RDC.loadEngine( new URL( "file:/"), new ByteArrayInputStream( engineData.getValue() ), Engine.EXPORT_DATA, null ); }
This type of embedding is also used for the i-net Designer.