I've been playing with iReport (older version 3.0.0) for a while and I can't seem to find a way to make just a static table, which seems silly and leads me to think that I'm just dense. Can someone point me in the right direction? The goal is to generate a report with a table with 2 columns: segment # and segment name. For each report, there will always be 20 segments, so the end report would look something like the following:
| 1 | <segment name> |
| 2 | <segment name> |
...
| 20 | <segment name> |
Thanks in advance for any help.
Creating a DatasetRight-click the report root node in the outline view and choose Create Dataset: 2. In the Dataset wizard, name your dataset, choose Create new dataset from a connection or Data Source and click Next. The Dataset - Data Source window opens.
The normal way to create a table in Jasper is to use text-boxes (I know, this is not so normal, but Jasper is just dense)
To understand Jasper, you need to understand how the bands work.
The Detail
band is used for each row of your data.
In the Detail band you should create two Text Field
s, one with $F{segment_id}
and one with F${segment_name}
(Assuming your query use those fields).
When you run the report, this will become your table body.
To add a header to your table, use the Column Header
band. Add Static Text
s with 'ID' and 'Segment Name' - this will appear as a table header on each page.
Note that you should keep the text-boxes close together, taking the whole band hight, so it will look like a table and not just floating text-boxes.
(Note - this is the classic way to create tables in Jasper, but the new Jasper versions also contain a Table
element designed specifically for tables)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With