When a user clicks Create > Ad Hoc View on the Home page, the Select Data wizard offers a path to a list of Topics populated from the Ad Hoc Components/Topics folder in the repository. There are two types of Topics:
| • | JRXML-based Topics – Created by administrators using Jaspersoft® Studio and uploaded as JRXML files to the proper location in the repository. Topics are typically of this type. |
| • | Domain Topics – Created from a Domain by administrators using JasperReports® Server. |
Either type of Topic is an empty view associated with a data source in the server, and is then built on in the Ad Hoc Editor.
Uploading a Topic Through the Web UI
JRXML-based topics are the most common type of topic. You can upload previously created JRXML topics via the repository.
To upload a JRXML-based Topic:
| 1. | Log into the server as administrator and select View > Repository. |
![note-icon-ns_28x28.png.da133a01a91e419d218348ca2447ad68.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) | While any user with sufficient repository permissions can upload a Topic to the server, this example requires an administrator login to access the JServer Jdbc data source. |
| 2. | Locate the folder where Topics are stored. The location of the Topics folder depends on your system configuration; by default, Topics are in the Ad Hoc Components > Topics folder. |
| 3. | Right-click the Topics folder name and select Add Resource > JasperReport from the context menu. The Set Up the Report page of the JasperReport wizard appears. |
![note-icon-ns_28x28.png.115522a0e14f8d7d24e9aa3363d6135e.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) | Add Resource appears on the context menu only if your login account has write privilege to the folder. |
| 4. | In the Set Up the Report page, give the Topic a name, a Resource ID, and an optional description, then click Next. |
| • | The Name field is the visible name of the file in the repository, such as Example Topic. |
| • | The Resource ID field is the internal ID of the object, such as Example_Topic. The server does not accept spaces in an internal ID. |
| • | The Description field, such as Topic uploaded for User Guide example, helps users understand the purpose of the file. |
| 5. | In the Locate the JRXML File section, select Upload a Local File, and click Browse to locate the file and upload the Topic from the file system. In this example, the file is <js-install>/samples/adhoc/topics/adhoc_sample.jrxml. |
![note-icon-ns_28x28.png.30197be3f98a108d577eed9d13588a5c.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) | To locate adhoc_sample.jrxml, you need access to the server host file system. |
![note-icon-ns_28x28.png.a79cf66390394ead7e466b99adeb0585.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) | Because this is a simple Topic without parameters, there are no controls and resources associated with it. If the Topic has a Parametrized query, you can create input controls for it. See Selecting a Data Source for Running the Complex Report. Such input controls can appear in the Ad Hoc Editor and when the report is run. |
| 7. | Click Select data source from repository and Browse to locate the data source named Data Sources/JServer Jdbc data source. |
| 8. | Select Data Source, then click Select. |
Topics must be associated with the data source that they were designed for.
| 9. | Click Submit at the bottom of the screen. |
Topics usually do not need a query or customization, but you can define them.
When you select Create > Ad Hoc View and click
in the Select Data wizard, you can browse to Ad Hoc Components > Topics. If you select the Example Topic, you can create a report using the columns available in the data source selected in step 7.
When you create a JRXML file for use as a Topic, you can specify the name to display for each field that the Topic returns. To do so, define a field property named adhoc.display for each field declared in the JRXML. The adhoc.display field property must have the following syntax:
<property name=”adhoc.display” value=”Any Name”/>
![note-icon-ns_28x28.png.cb50037278961d58538946dc3284a08b.png](https://community.jaspersoft.com/applications/core/interface/js/spacer.png) | If the Topic includes fields with unusual datatypes, those fields don't appear in the Ad Hoc Editor because it's not equipped to manage them properly. For example, if the Topic is defined against a MongoDB instance that returns data of type array, this field isn't available in the Ad Hoc Editor. For more information on datatype support in the Ad Hoc editor, see the JasperReports® Server Administrator Guide. |
For example, this JRXML code declares a StoreState field that is displayed in reports as Store State:
<field name=”StoreState” class=”java.lang.String”>[/code] <property name=”adhoc.display” value=”Store State”/></field>[/code] |
Topics also support the $R expressions for field names; for more information, see Localizing Reports.
For fields in a non-domain topic the following properties may be of interest:
| • | dimensionOrMeasure: marks a field as a field or a measure |
| • | defaultAgg: which aggregation should be used for this measure (avg, etc) |
| • | semantic.item.desc: A description for the field |
| • | defaultMask: set a measure as a $, date etc |
For more information on working with JRXML topics, see the Jaspersoft® Studio User Guide.
Recommended Comments
There are no comments to display.