Jump to content
We've recently updated our Privacy Statement, available here ×

sorting main report and sub-report with xml datasource


visert

Recommended Posts

Hi

main report "MR"... and its sub report "SR".

Data into XML are in 1:n relationship cardinality between MR -> SR records (mr01 -> sr01, mr01->sr02... ecc ecc).

Data source is a JRXMLdatasource ( a XML file).

Without sorting, the report is printed correctly, But I need to sort both MR and SR records.

I pass the datasource from MR to SR with tipical sentence:

"((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("field")

If I try to sort  a field into MR:  the JRXMLDataSource "became" ListOfArrayDataSource and so I need to change the sentence into

((net.sf.jasperreports.engine.data.ListOfArrayDataSource)$P{REPORT_DATA_SOURCE})

 otherwise I ("correctly") receive a cast exception

ClassCastException ListOfArrayDataSource cannot be cast JRXmlDataSource.

Well... no compile error, no runtime error, but SR is empty. I think because to sort MR the engine has "finished" records?

It's possibile inside SR command the restart of scanning of record? If yes... will be correctly assigned to MR records?

Thank you to all for help.

bye

best regards to all!

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

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...