Jump to content
Changes to the Jaspersoft community edition download ×

xmldatasource and crosstab


alucard__

Recommended Posts

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 this 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!

Link to comment
Share on other sites

  • 4 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...