Jump to content

lionelv

Members
  • Posts

    4
  • Joined

  • Last visited

lionelv's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. I got it working pretty quickly using your post as a guide. I've forgotten what the exception was from that I posted, d'oh, I was going to post it for future searches. It was something like passing the wrong class type in. Anyway, for anyone else who might read this: To use a custom JRDataSource in a sub-report including the implementations of JRDataSource provided such as JRMapCollectionDataSource you design your sub-report as normal. Under data source you specify "Custom data source" and delete all the stuff about factory classes etc. You then add the fields to the report that you are going to send in the data source. You need to add a parameter to the master report in iReport of type Object. When you add your sub-report you can look at the properties and tell it where to get the data-source. Tell it custom data source and then in the second text box type (for a JRMapCollectionDataSource): new JRMapCollectionDataSource(java.util.ArrayList(parameterObject)) The parameter you pass in must be a List (or Collection, sorry I can't remember because I don't have iReport on this computer but List definitely works) of Map instances. Now each instance of Map will have key-value pairs. The key is the field name in the sub-report and the value is the field value. If anyone is reading this and needs further advice please email me lionelv at gmail dot com Lionel.
  2. lucianc wrote: Can you post the full exception stack trace and relevant JRXML/code fragments? What I'll do is follow the instructions you have posted here and see how I go. If I still have a problem then I will come back with the stack trace. It may be a day or a few days before I get to work on it again as it is only my casual job. Hopefully tonight though (which is 10 hours away for me :)). Thanks Lionel.
  3. Hi lucianc, I thought that I would start by making a blank report and trying to pass in a JRMapCollectionDataSource which is initialised with an ArrayList containing one String element. However I ended up with: java.io.StreamCorruptedException: invalid stream header Do you happend to know what might cause this? Can we elaborate on how this works, the API documentation I have found doesn't have any detail :(. So if I pass in a JRMapCollectionDataSource successfully how do I access the fields, what do they show up in ireport as? Do they have names? How are the names determined? Getting a bit further ahead and on the topic of adding the theta data to a subreport do I add JRMapCollectionDataSource to the parameters or do I add the ArrayList and then when I pass it to the subreport I select "Use Custom Datasource" and provide new JRMapCollectionDataSource($P{thetaCollection}) as the data source? thanks Lionel.
  4. Hi all, I've searched through the documentation and this has been discussed in various ways but I haven't got a grip on the best approach or how I should do this. I have a report that I use fillReport(JasperReport jasperReport, java.util.Map parameters, java.sql.Connection conn) on. However, I also want to add 1 or more rows to a separate section in the report from data that is generated in my Java program and is not in the database. I can store this data as any implementation of a Collection if necessary. Each row is a pair such as: theta(1) someDoubleValue1 theta(2) someDoubleValue2 What is the best approach to do this? The desired result is very roughly like this: //data from some sort of list: theta(1) value ..... ... //data retrieved from database that has several columns column1 column2 column3 . . . . Thanks Lionel.
×
×
  • Create New...