Hi all and.. sorry for my english :)
I'm new to jasperreports.
I am starting with a simple report like this
__|C1_|C2_|..|Cm
R1|V11|V12|..|V1m
R2|V21|V22|..|V2m
................
Rn|Vn1|Vn2|..|Vnm
My datasource is a xml file
<db>
<element>
<r></r>
<c></c>
<v></v>
</element>
</db>
I've created a new XML datasource
("Use the report xPath expression to fill the report" radioButton selected)
looking at [url=http://www.jasperassistant.com/forum/viewtopic.php?p=4448&sid=5280fa21e1... I used /db/element as primary query
I've also made a subdataset with /db/element[$P{POSITION}]
POSITION is a java.lang.Integer
I pass $V{REPORT_COUNT}
In this subdataset I've defined the r, c and v fields
I've put a crosstab in summary (I've also tried to put it in detail)
I've used the subdataset with the crosstab, setting r as row group, c as column group and v as detail (function: nothing).
In the crosstab property windows, I've added the POSITION parameter.
The report compiles without problems.
When I try to fill the report (Build->Execute with active connection) the result is a empy page.
I also tried to change the "Connection/Data Source Expression" to "Use a data Source" XML_DATA_DOCUMENT and passing
the xml file like in the xmldatasource example
Map params = new HashMap();
Document document = JRXmlUtils.parse(JRLoader.getLocationInputStream("db.xml"));
params.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document);
...
JasperFillManager.fillReportToFile(fileName, params);
when i fill the report an exception is throw
JRXPathQueryExecuterFactory org.w3c.dom.Document document is null??
What's wrong??
Can you show me a simple example with xmldatasource and crosstab?
Tnx in advance!
I'm new to jasperreports.
I am starting with a simple report like this
__|C1_|C2_|..|Cm
R1|V11|V12|..|V1m
R2|V21|V22|..|V2m
................
Rn|Vn1|Vn2|..|Vnm
My datasource is a xml file
<db>
<element>
<r></r>
<c></c>
<v></v>
</element>
</db>
I've created a new XML datasource
("Use the report xPath expression to fill the report" radioButton selected)
looking at [url=http://www.jasperassistant.com/forum/viewtopic.php?p=4448&sid=5280fa21e1... I used /db/element as primary query
I've also made a subdataset with /db/element[$P{POSITION}]
POSITION is a java.lang.Integer
I pass $V{REPORT_COUNT}
In this subdataset I've defined the r, c and v fields
I've put a crosstab in summary (I've also tried to put it in detail)
I've used the subdataset with the crosstab, setting r as row group, c as column group and v as detail (function: nothing).
In the crosstab property windows, I've added the POSITION parameter.
The report compiles without problems.
When I try to fill the report (Build->Execute with active connection) the result is a empy page.
I also tried to change the "Connection/Data Source Expression" to "Use a data Source" XML_DATA_DOCUMENT and passing
the xml file like in the xmldatasource example
Map params = new HashMap();
Document document = JRXmlUtils.parse(JRLoader.getLocationInputStream("db.xml"));
params.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document);
...
JasperFillManager.fillReportToFile(fileName, params);
when i fill the report an exception is throw
JRXPathQueryExecuterFactory org.w3c.dom.Document document is null??
What's wrong??
Can you show me a simple example with xmldatasource and crosstab?
Tnx in advance!
1 Answer:
Posted on March 9, 2008 at 10:07pm
In case you are in still in need for an answer, have a look at my [url=http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=215&f... describing a simular problem. The crosstab needs it's own seperate dataset/datasource which can be a copy/reference to the report datasource or a new dataset based on a subset of the reports dataset. You can use Java code in the expression tags.