You can populate reports created in Jaspersoft Studio with data from TIBCO Spotfire. You can navigate your Spotfire library, select Information Links and Spotfire Binary Data Files (SBDFs), and inspect their data. To load Spotfire data, create a data adapter to connect to the data. The data adapter will return data in tabular form. Before you publish the report to JasperReports Server, export your data adapter as an XML file so you can add it to the server's repository.
| This version of Jaspersoft Studio was verified with Spotfire version 7.7. Other versions may also work but have not been tested extensively. |
To create a data adapter for a Spotfire Information Link:
| 1. | In the Repository Explorer, right-click Data Adapters and select Create Data Adapter to display the Data Adapter wizard. |
| 2. | Enter a name for the data adapter. |
| 3. | Enter the URL to your Spotfire Web Player in this form: |
http://<web-player-host>/SpotfireWeb
where <web-player-host> is the IP address or name of the computer hosting the Spotfire Web Player where you access your Information Link.
| 4. | Enter your Spotfire user name and password. |
| 5. | Click Browse next to the Resource ID field to locate and select your Information Link |
|
Spotfire Library displayed in Jaspersoft Studio |
You can also create reports against SBDFs ; to do so, select one from your Spotfire library.
| 6. | If you have prompts in your information link and want to set their values using parameters in Jaspersoft Studio, make sure Use a query (required to use parameters) is selected. |
| 8. | Click Test to test your connection. |
| 9. | If the test fails, check your URL, credentials, and resource ID. |
| 10. | When the test succeeds, click Finish. |
| It isn't uncommon for an Information Link to return millions of rows of data, which may take a some time for Jaspersoft Studio to process when data is loaded, such as when previewing the report; the same may hold true in JasperReports Server. |
To create your report:
| 1. | Click File > New > JasperReport. |
| 2. | Select template and enter a name for your report. |
| 3. | Click Next. The Data Source dialog is displayed. |
| 4. | Select the Spotfire Information Link data adapter you created above. |
| 5. | If you have prompts, you need to configure parameters to work with them. See Working With Prompts for more information. |
| 7. | Select the fields to include in your data set. |
| 9. | Optionally select a field to define grouping. |
| 10. | Click Finish. Jaspersoft Studio displays the report in the Design tab. |
| 11. | Edit the report as needed. For example, add fields and components and configure your query and dataset. |
| 12. | Click Preview to ensure that the report is correctly configured. |
| 13. | When your report is ready, click File > Save. |
To export your data adapter as an XML file:
| 1. | In the Repository Explorer, right-click your Spotfire Information Link data adapter and select Export to File. |
| 2. | Select the folder in your Jaspersoft Studio workspace that contains your report, enter a name for the data adapter, and click OK. |
To configure the report to use the exported data adapter:
| 1. | In the Outline view, click the root node of your report to display the report properties. |
| 3. | Expand Misc and click the ellipsis to the right of Properties to open the Properties window. |
| 4. | Click Add to create a property that indicates the data adapter to use. |
| 5. | In the Property Name field, enter net.sf.jasperreports.data.adapter. |
| 6. | In the Value field, enter the name of the data adapter you exported (this is an XML file). |
You're ready to publish your report.
To publish your report:
| 1. | Click |
| 2. | Select a server connection and navigate its repository to the desired location. |
| 3. | Optionally enter a new label, name (ID), and description of the report unit. |
| 4. | Click Next. You're prompted to select a resource used by the report, including the data adapter you exported above. |
| 5. | Click Next. You're prompted to select a data source. |
| 6. | Select Don't use any Data Source. Since the data adapter has already been defined, the report doesn't need a separate data source. |
| 7. | Click Finish. Jaspersoft Studio adds your report to the repository. |
While it's uploaded, Jaspersoft Studio modifies your JRXML so that it will run properly on the server. In particular, it changes how the data adapter is specified. On the server, the data adapter is uploaded to the folder you selected when you published the report.
To test your report, open the server's web UI, locate your report, and click it to run it.
Working With Prompts
If your Information Link uses prompts, you need to configure parameters for those prompts before you can read fields. You must configure parameters for all prompts, even if they are not Mandatory in Spotfire.
To use prompts, make sure that you selected Use a query (required to use parameters) in your data adapter. Create the report as described in the previous steps.
Configuring Jaspersoft Studio Parameters for Use With Spotfire Prompts
The Dataset and Query dialog shows the prompts for your Spotfire Information Link. You must configure parameters for your prompt based on the Type and Extra values.
Prompts in Dataset and Query dialog |
|
List (corresponds to prompt type Values)
Class Type – java.util.Collection; the objects in the collection should correspond to the Type of the prompt. The data adapter mechanism formats the Collection contents appropriately.
Sample Default Value Expression – Arrays.asList(1,2,3,4,5,6,7)
Range
Class Type – java.lang.String
Default Value Expression – The default value expression must be two Strings with a caret (^) between them. Most often, you will want to create three parameters in Jaspersoft Studio: two parameters that define the endpoints of the range and a third parameters of type String that is used to pass the Range to Spotfire. The endpoint parameters should correspond to the Type of the prompt.
For example, for a Range prompt of type DateTime, you might create two parameters of type java.sql.Timestamp that are used to take input for the start and end time:
Then you would create a dependent parameter that uses these two parameters to construct a String to pass to Spotfire:
The parameters would look like this on the parameters tab.
Range parameters in Parameters tab |
|
Multiple selection
Class Type – java.util.Collection; the objects in the collection should correspond to the Type of the prompt. The data adapter mechanism formats the Collection contents appropriately.
Sample Default Value Expression – Arrays.asList(1,2,3,4,5,6,7)
Single selection
Class Type – Corresponds to the Type for the prompt. Numbers (and Currency) are passed with a “9.9999” format; no $ or , are used.
Connecting Prompts from Spotfire to Parameters in Jaspersoft Studio
| 1. | If you are not in the Dataset and Query dialog, open it by right-clicking on the root node of your report in Outline view and selecting Dataset and Query… from the context menu. |
| 2. | Select the correct data adapter and select spotfire as the language. |
Jaspersoft Studio connects to the Spotfire server and returns the list of prompts for the Spotfire Information Link.
| 3. | To map a prompt to a parameter: |
| a. | Double-click on a prompt. The GUID for the prompt is displayed, followed by an equals sign (=). |
| b. | Type the name of the parameter you want to use after the equals sign (=) in the form $P{ParameterName}. For example, for the date range prompt above, you would enter $P{OrderDateRange}. |
Prompts with GUIDs mapped to parameters |
|
| 4. | Repeat these steps for each prompt. |
| 5. | Once you have correctly configured your parameters, click Read Fields to read the fields. |
| 6. | Click OK to close the Dataset and Query dialog. |
Recommended Comments
There are no comments to display.