Jump to content
Changes to the Jaspersoft community edition download ×

Jasper expecting diff mapping at page break


2004 IR Help

Recommended Posts

By: Mark Poland - mpoland

Jasper expecting diff mapping at page break

2005-06-30 13:42

I have a report with this structure:

 

Main Report ([zero or more])

DOCID:

TITLE:

DocType (sub-report [zero or more])

Author (sub-report [zero or more])

Addressee (sub-report [zero or more])

Related Document (sub-report [zero or more])

 

The Related Docuent sub-report contains the same structure as the main report except no related documents:

DOCID:

TITLE:

DocType (sub-report same as above)

Author (sub-report same as above)

Addressee (sub-report same as above)

 

I use a custom JRDataSource object to fill the report. Basically its an array of objects that get iterated over based on calls to the next() method. The next method stores values in a map that jasper accesses using the getFieldValue method. This works well most of the time. Occasionally Jasper seems to expect another sub-report data when there is no more data. The best way to explain it is to show you the output using // for comments:

 

 

next(): // maps the document data

// output of main report document data getting mapped

DOCID: 143168

TITLE: blah blah

hasNext = true // next returns true

 

// jasper gets the mapped data correctly

field value DOCID = 143168

field value TITLE_SUBJECT = blah blah

 

next(): // get the next sub-report or main document

new subrep // DocType sub-report found

map: // map doctype data

size: 1 // only one doctype

// mapping output

DOC_TYPEDESC: CORRESPONDENCE

hasNext = true // next returns true

 

// jasper gets the mapped data correctly

field value DOC_TYPEDESC = CORRESPONDENCE

 

next(): // get the next doctype

hasNext = false // next returns false; no more DocTypes

 

next(): // get the next sub-report or main document

new subrep // Author sub-report found

map:

size: 1

// mapping output

AUTHOR: ABC

ORG: ORG

hasNext = true

 

// jasper gets the mapped data correctly

field value AUTHOR = ABC

field value ORG = ORG

 

next(): // get the next author

hasNext = false // next returns false; no more authors

 

next(): // get next sub-report or main document

new subrep // Addressee sub-report found

map:

size: 1

// mapping output

AUTHOR: BCD

ORG: ORG

hasNext = true

 

// jasper gets the mapped data correctly

field value ORG = ORG

field value AUTHOR = BCD

 

next(): // get next addressee

hasNext = false // no more addressees

 

next(): // next sub-report or main document

new related_rep // related document found

 

next(): // related document's next function

// mapping output

new document map:

DOCID: 143169

TITLE_SUBJECT: blah blah

hasNext = true

 

// jasper is expecting another addressee????

relDatSrc.getFieldValue()

field value ORG = null

relDatSrc.getFieldValue()

field value AUTHOR = null

 

This seems to happen only at a page break. Has anyone encountered this problem?

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