Use case
This guide will go through the configuration to embed the Ad Hoc Designer within an application using an iFrame while enforcing the use of a specific Topic. This requires an HTTP source URL pointing directly to the designer, using the Topic's URI as a parameter so that the usual Topic or Domain selection popup is bypassed.
Resolution
Only a single file needs to be updated, 'adhocFlow.xml'
- locate the file under `<Path_to_JasperReports_Server>/WEB-INF/flows:
- Open the adhocFlow.xml and modify the action-state 'startAdHoc' by changing the transition on `createReport` as follows:
<action-state id="startAdHoc"> ... <transition on="createReport" to="createEmbeddedReport"/> <!-- change --> ... </action-state>
- Add the definition of the decision-state 'createEmbeddedReport' that we now use in the transition on `createReport`. This can be placed anywhere within the file, but it must be outside the definition of other elements.
<!-- add --> <decision-state id="createEmbeddedReport"> <if test="requestParameters._eventId == 'startAdHocWithTopic'" then="initForTopic" else="realmsView" /> </decision-state> <!-- add -->
- Proceed with a server restart.
iFrame source URL samples:
-
For Chart View:
http://localhost:8080/jasperserver-pro/flow.html?_flowId=adhocFlow&realm=%2Forganizations%2Forganization_1%2Fadhoc%2Ftopics%2FAdhocDemo&_eventId=startAdHocWithTopic&reportType=ichart -
For Crosstab View:
http://localhost:8080/jasperserver-pro/flow.html?_flowId=adhocFlow&realm=%2Forganizations%2Forganization_1%2Fadhoc%2Ftopics%2FAdhocDemo&_eventId=startAdHocWithTopic&reportType=crosstab -
For Table View:
http://localhost:8080/jasperserver-pro/flow.html?_flowId=adhocFlow&realm=%2Forganizations%2Forganization_1%2Fadhoc%2Ftopics%2FAdhocDemo&_eventId=startAdHocWithTopic&reportType=table
Key Points
- The 'realm' URL parameter value should be the URL-encoded JasperReports Server's path for the Domain Topic or the JRXML topic used as the Ad Hoc designer's source.
- 'realm' cannot take the path's URI of a Domain, as using it in the Ad Hoc Designer would require additional steps like selecting specific fields and measures, and eventually defining pre-filters.
- Remember to update the domain and port in the sample links to match your setup.
Additional Notes
- A sample modified `adhocFlow.xml` file (based on version 6.1) is available for reference.
Ref. Case 00061244
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now