caulfield14 Posted January 16, 2007 Share Posted January 16, 2007 My report contains a collection typed as a superclass which has two subclasses. Subclass 1 has a name property. Subclass 2 has a nameMessageCode property which contains a message code to be retrieved from the localized message property file. In order to get reference the properties of the subclasses, the name and nameMessageCode properties are declared in <field> tags. However, when the report is run, JR checks to see that all the defined fields exist on the object, regardless whether the field is used. I was going to use a conditional to display the name field for objects of subclass 1 or str(${nameMessageCode}) for objects of subclass 2. Unfortunately, JR dies looking for the nonexistent nameMessageCode property on sublclass 1 objects or the nonexistent name property on subclass 2 objects. Is there a way to prevent JR resolving fields until they are acutally used? Thanks! Link to comment Share on other sites More sharing options...
Teodor Danciu Posted January 17, 2007 Share Posted January 17, 2007 Hi, You could use your own data source implementation if the provided one does not work as you expect.In JasperReports, if you declare a report field, it means you are alreay using it, just because it is declared.You could subclass the data source implementation and make it silently ignore inexistant properties in the beans. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
lilyjung Posted February 7, 2007 Share Posted February 7, 2007 I am interested in the implementation of this since I have the same problem. Right now, I have reports fields called field1, field2, field3, etc. If I don't provide it with field3, I get an "Unknown column name : FIELD3" exeception. I am passing in a JRResultSetDataSource. Does this mean, I sould have a fieldless jrxml file and somehow pass in the fields? Thanks. Link to comment Share on other sites More sharing options...
lilyjung Posted February 8, 2007 Share Posted February 8, 2007 I am interested in the implementation of this since I have the same problem. Right now, I have reports fields called field1, field2, field3, etc. If I don't provide it with field3, I get an "Unknown column name : FIELD3" exeception. I am passing in a JRResultSetDataSource. Does this mean, I sould have a fieldless jrxml file and somehow pass in the fields? Thanks. Link to comment Share on other sites More sharing options...
lilyjung Posted February 8, 2007 Share Posted February 8, 2007 I am interested in the implementation of this since I have the same problem. Right now, I have reports fields called field1, field2, field3, etc. If I don't provide it with field3, I get an "Unknown column name : FIELD3" exeception. I am passing in a JRResultSetDataSource. Does this mean, I sould have a fieldless jrxml file and somehow pass in the fields? Thanks. Link to comment Share on other sites More sharing options...
caulfield14 Posted February 8, 2007 Author Share Posted February 8, 2007 In JasperReports, if you declare a report field, it means you are alreay using it, just because it is declared.You could subclass the data source implementation and make it silently ignore inexistant properties in the beans. Yeah, I was afraid of that. The problem is that I am sending a List instead of a JR DataSource. The list contains Entities retrieved from Hibernate. I found a workaround with my entities rather than trying to extend the DataSource. Thanks for the confirmation though.g. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now