Jump to content

MasterDetail Report with the CustomDataSource


ssa_sbobba

Recommended Posts

I am creating master-detail report with the custom datasource.

 

In master report, I am having one subreport.in that subreport I am having another subreport.

 

I am having the xml data like this.

<?xml version="1.0" encoding="ISO-8859-1"?>

<job.report job.id="2007_06_15__06_23_31_firehose">

<record record.id="1" input.file.number="0" previous.undeliverable.count="-1">

<transaction type="15" time="2007-06-15T06:23:36 />

<transaction type="7" time="2007-06-15T06:46:38" />

<transaction type="7" time="2007-06-15T06:46:39" />

<transaction type="8" time="2007-06-15T06:46:39"

</record>

<record record.id="2" input.file.number="0" previous.undeliverable.count="-1">

<transaction type="1" time="2007-06-15T06:23:36 />

<transaction type="6" time="2007-06-15T06:46:38" />

<transaction type="4" time="2007-06-15T06:46:39" />

<transaction type="2" time="2007-06-15T06:46:39"

</record>

<job.report>

 

So I have created the one main report to display the job.report tag details and one subreport.

 

Main Report is – JobView.jrxml

Sub Report is –Record.jrxml

Sub Report is – JobViewTransactions.jrxml

 

The JobViewTransactions is subreport in the Record.jrxml file.The Record.jrxml file is subreport of Jobview.jrxml.

 

The JobViewTransactions.jrxml file is displaying the transaction tag details of each record.

 

Problem: I am getting all the transactions details under the first record details.

 

Requirement is: I want to display the details in the following manner.

 

The transaction details belonging to record id that transaction details display under that record

 

Record Id 1

Type 15

Type 7

Type 7

Type 7

Type 8

Record 2

Type 1

Type 6

Type 4

Type 2

 

But Right now, I am getting in this manner

 

Record Id 1

Type 15

Type 7

Type 7

Type 7

Type 8

Type 1

Type 6

Type 4

Type 2

Record 2

 

 

I have enclosed the java file and the jrxml files.

 

If I am setting the custom datasources to the datasourceExpression in the jrxml file, then is it necessary to user the queryString in the jrxml file.

 

How to pass recordid to the subreport? I want to display the transaction details under the record. Those transactions should belong to that record only

 

[file name=subreport.zip size=8544]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/subreport.zip[/file]

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

ssa_sbobba wrote:

If I am setting the custom datasources to the datasourceExpression in the jrxml file, then is it necessary to user the queryString in the jrxml file.

 

No, the report query is not used when a data source is sent to the sub/report (I assume that was a question).

 

How to pass recordid to the subreport? I want to display the transaction details under the record. Those transactions should belong to that record only

 

If you want to display transactions belonging to the current record only, then you need to create a data source that iterates on those transactions only. You cannot use the same transactions data source for two different records. As a note, a data source can only be used more than once if it's rewound (see JRRewindableDataSource) between reuses (i.e. a data source is like a java.util.Iterator).

 

HTH,

Lucian

Link to comment
Share on other sites

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