I have a very simple XML datasource structured like this:
<datasource>
<row>
<column>Some text 1</column>
<column>Some text 2</column>
<column>Some text 3</column>
</row>
<row>
<column>Some text 4</column>
<column>Some text 5</column>
<column>Some text 6</column>
</row>
<row>
<column>Some text 7</column>
<column>Some text 8</column>
<column>Some text 9</column>
</row>
</datasource>
And I want to create a very simple XLS report formatted like this:
-------------------------------------------
| Some text 1 | Some text 2 | Some text 3 |
-------------------------------------------
| Some text 4 | Some text 5 | Some text 6 |
-------------------------------------------
| Some text 7 | Some text 8 | Some text 9 |
-------------------------------------------
I have created a report with the XPath query:
/datasource
And two fields:
$F{row}
$F{column}
with expressions:
row
row/column
respectively.
I have added a crosstab element to the Detail band and have made a few attempts to configure it with different variations of the fields defined above for the row and column grouping options. But the best result I have been able to get is the 1st column value (i.e. "Some text 1" value in the above example).
My questions:
- How can I configure the crosstab element to iterate over each row element in my datasource and push the column values into the right cells as per the example above?
- Is the crosstab element the most suitable element for this type of task?
Ok so I have figured it out and I really cannot pin point any one source as a good point of reference for this stuff. Jasper's documentation and community contribution is for the most part sparse and dated. I digress. Here is what I did to get it working for iReport 4.5.0 and Jasper 4.5.0:
So that's it. For me this is what I need to solve the crosstab / XML datasource / sub dataset conundrum!