Jaspersoft Studio supports a random data source that determines the field types and returns random data in each field. You can set how many records are returned. Here are some of the ways you can use the random data adapter to test a report:
| • | Use a small number of records to visualize a chart. |
| • | Use a large number of records to simulate a multi-page report. |
| • | Use it as the data source for a subreport, subdataset, or table. |
To create a new random data source in the current folder:
| 1. | Select File > New > Data Adapter from the main menu or select New > Data Adapter from the context menu of a folder. The Data Adapter Wizard opens. |
| 2. | Select the folder where you want to place the adapter and click Next. |
| 3. | Select Random records from the data adapter list and click Next. |
Random records data adapter type |
|
| 4. | Name the adapter and set the number of records you need. |
Choosing a number of random records |
|
| To create a global random data adapter that you can use in different projects, go to the Project Explorer and select New > Data Adapter from the context menu. Global data adapters can't be accessed from JasperReports Server or JasperReports IO project types. |
Using the random data source in a new subreport, subdataset, or table:
| 1. | Drag the element you want from the palette to the canvas. |
| 2. | Select Create ... using a new dataset and click Next. |
| 3. | Select Create new dataset from a connection or Data Source and click Next. |
| 5. | Follow step to step 5 in the previous instructions. |
Editing a dataset run to use a random expression:
If you already have your subreport, subdataset, or table set up, you can edit the dataset run as follows:
| 1. | Select the element where you want to use a random dataset. |
| 2. | If you don't already have the Properties view displayed, right-click and select Show Properties. |
| 3. | In Properties view, in the Dataset Run section, select Use a JRDatasource expression and enter: |
new RandomDataSource(n);
where n is the non-negative integer number of records you want.
Setting a data source expression |
|
Recommended Comments
There are no comments to display.