2004 IR Help Posted September 2, 2006 Share Posted September 2, 2006 By: Quique - guacamato Nested object properties and iReport fields 2004-06-28 09:46 Hi, I am creating a report where my fields are properties from a Java class. But as I used nested properties, the report doesn't compile, because of the way iReport tries to compose the name for the field: dori.jasper.engine.JRException: Errors were encountered when compiling report expressions class file: C:iReport-0.3.0Salida_Hipermercado.java:36: ';' expected private JRFillField field_embalaje.codEmbalaje = null; How can I declare fields that have to be populated from a nested property (like object.object.code, for example)? Thanks in advance, Enrique Medina. By: Giulio Toffoli - gt78 RE: Nested object properties and iReport fields 2004-06-29 02:47 you can do something expressions like this ((it.is.my.bean.Person)$F{Person}).getProperty("name") In this case Person field is declared simply as java.lang.Object Giulio By: Quique - guacamato RE: Nested object properties and iReport fiel 2004-06-29 09:18 Hi Giulio, But then, I get an error that "it.is.my.bean.Person" does not exists. So I have to include in the classpath my classes, haven't I? Enrique Medina. By: Juan Ara - fi2net@Spain - laureke RE: Nested object properties and iReport fields 2004-06-30 00:38 You need your clases in classpath. If you're using iReports for several apps you can create a bacth file for each app, adding classpath of the app to the batch file (preventig heavy classpath load, since iReports copies classpath classes to his "work" directory). You can access your properties as usual: ((org.sample.MyPerson)$F{person}).getName(); ((org.sample.MyPerson)$F{person}).getAddress(); ((org.sample.MyPerson)$F{person}).getField(xxxx); You can also declare variables to make it easy to maintain: variable person type org.sample.MyPerson initiall value new MyPerson() value $F{person} Calculation group "persons" And don't forget set up calc. times on the report. 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