When a user clicks Create Ad Hoc View on the Home page, the list of Topics on the Topics tab is populated from the Ad Hoc Components/Topics folder in the repository. There are two types of Topics:
• JRXML-based Topics – Created by administrators using iReport 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 report associated with a data source in the server, and is then built on in the Ad Hoc Editor.
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.
|
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 and select Add Resource JasperReport from the context menu.
|
Add Resource appears on the context menu only if your login account has write privilege to the folder. |
After selecting Add Resource JasperReport, the Set Up the Report page of the JasperReport wizard appears.
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.
|
To locate adhoc_sample.jrxml, you need access to the server host file system. |
|
Because this is a simple Topic without parameters, there are no controls and resources associated with it. If the Topic has a Parameterized query, you can create input controls for it. See section 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.
Topics must be associated with the data source that they were designed for.
8. Click Next.
9. In Locate Query, click Submit.
Topics usually do not need a query or customization, but you can define them.
When you select Create > Ad Hoc View, the Example Topic appears on the Topics tab of the Data Chooser wizard. If you select the Example Topic, you can create a report using the columns available in the data source selected in See "Click Select data source from repository and Browse to locate the data source named Data Sources/JServer Jdbc data source.".
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”/>
For example, this JRXML code declares a StoreState field that is displayed in reports as Store State:
<field name=”StoreState” class=”java.lang.String”> <property name=”adhoc.display” value=”Store State”/> </field> |
Topics also support the $R expressions for field names; for more information, see section 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
In some circumstances, it is important to create a Topic based on the Domain and data settings you chose. In other circumstances, creating a Topic isn’t necessary. The main consideration is how reports based on the Domain-based View are used. The following table explains the choices:
If you want to … |
Then do this |
Explanation |
Create a single-use report from the Domain with your settings. |
Click Table, Chart, or Crosstab after defining your settings in the Data Chooser wizard, then format the View and create your report. |
Your field selections appear in the Ad Hoc Editor and you can create Views from them, but the settings themselves are not saved. |
Run a report repeatedly as is or with prompting for new input, or make very similar reports in the Ad Hoc Editor. |
Click Table, Chart, or Crosstab after defining your settings in the Data Chooser wizard, then format and save the View in the Ad Hoc Editor. |
After you save a View, users can create reports to be run from it repeatedly and be prompted for input each time if you defined unlocked filters. |
Reuse your field, filter, and display settings on this Domain to create new Views with different formatting. |
After saving your settings as a Domain Topic on the Save as Topic page of the Data Chooser wizard, start a new View and choose your Domain Topic from the Domains tab. |
Domain Topics are saved in JRXML format in the repository. They appear on the Topics tab when you start a View. |
Be able to modify one or more of the settings you made in the Data Chooser wizard. |
After saving your settings as a Domain Topic on the Save as Topic page of the Data Chooser wizard, find your Domain Topic in the repository and open it in the Domain Designer. |
Domain Topics can be edited as described in section Editing a Domain Topic . After you save your changes, you can create Views based on the modified Domain Topic. |
Create Views from the same repository data source but with different Domain settings, such as derived fields and different joins to make new fields available in a report. |
Edit the Domain and save it with a new name. Then start a new View and choose your data from the new Domain. |
Domains provide advanced functionality such as table joins and derived fields based directly on a data source. Domains usually require administrator permissions to create and modify. |
If other users create reports from your Domain Topic-based View, and the Domain is configured for security, it is important to consider everyone’s access permissions. You might not have access to all of the fields in the Domain nor to all the data in those fields. There may be fields that can be seen only by other users, and in the fields that you can see, there may be data that is hidden from you. When you save the Domain as a Topic, only the fields that you selected appear in the Domain Topic. When you create a View from the Topic, only the data that you can access in those fields appears. When others create Views from the Topic, they see only fields that they have permission to access. These rules also apply to the reports generated from these Views.
For example, in a Domain, user Tomas can access fields B-C and data rows 1-3; Anita can access fields C-E and data rows 2‑5. Tomas uses the Data Chooser wizard and saves a Domain Topic based on the Domain. When Tomas and Anita create reports from the same View, they see different combinations of fields and the data in them.
|
Fields |
Data |
Tomas’s report from his Domain Topic |
B C |
1 2 3 |
Anita’s report from the same Domain Topic |
C |
2 3 4 5 |
Even though Anita has permission to see more fields, they are not available to her because Tomas did not have access to them when he created the Domain Topic. However, Anita does have permission to see more data than Tomas, so when she creates a View, or opens or runs the report based on that View, she can see more rows than Tomas can when he views the report. See section The Domain Security File for a technical explanation of data security for Domains. See the note in section Editing a Domain about the impact of editing a Domain or Domain Topic.
To save settings in the Data Chooser wizard as a Domain Topic:
1. While making selections in the Data Chooser wizard, navigate to the Save Topic page.
2. Enter a Topic name and description.
Do not change the location folder. Using the default /adhoc/topics folder makes the saved Domain Topic available on the Topics tab when you select Create Ad Hoc View.
3. If your data selections, filter definitions, and display settings are complete, click Table, Chart, or Crosstab.
|
If settings are incomplete, navigate to the other pages to finish, then click Table, Chart, or Crosstab |
The new Topic appears in the Ad Hoc Components Topics folder.
Because a Domain Topic is a type of report, it appears when the Search page is filtered to show reports:
You can modify a Domain Topic you created using the Data Chooser wizard.
To edit the settings in a Domain Topic:
1. Select View Repository and search (or browse) for the Domain Topic you want to modify.
Domain Topics are usually kept in the Ad Hoc Components Topics folder.
2. Right-click the Domain Topic and select Open in Designer from the context menu.
The Domain Topic opens in the Data Chooser wizard.
3. Follow the guidelines in section Using the Data Chooser Wizard to edit the Domain Topic as needed.
4. To save changes to the selected Domain Topic, click Table, Chart, or Crosstab on any page.
|
Use caution when editing Domain Topics that may have been used to create other Views. Users who relied on the Domain Topic might receive unexpected data or errors. It is safer to save changes as a new Domain Topic. |
To save changes as a new Domain Topic, navigate to the Save as Topic page and enter identifying information for the new Topic, then click Table, Chart, or Crosstab.