Jump to content
Changes to the Jaspersoft community edition download ×

Problem with nested Beans


midrag

Recommended Posts

Hi,

 

i am using a JRBeanArrayDataSource Datasource to fill my report.

There are nested Beans in the datasource. I can access the all getters except one!

 

my declared Field:

 

Code:
<field name="user.eMail" class="java.lang.String"/>

 

the Getter is named:

 

Data.getUser.getEMail(). Accessing the getter in Java is no Problem. Accessing other getters from User withhin the Report is also no problem.

 

Any hint of how to track down the Error? Is it a naming problem because of the "M" in eMail (unfortunatly i cant change the spelling?

 

thx in advance!,

 

midrag

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Can't you just have a field "user" and then access its objects with $F{user}.getEmail()? Not withstanding that, check that the class follows proper bean syntax rules with the appropriate getter and setter methods for that variable and that it has private visibility.

 

What type of error are you getting? If the above doesn't solve the issue, post some sample code and report info if possible.

 

HTH,

Robin

Link to comment
Share on other sites

hello rsilver@bfm.bm,

 

thanks for your answer!

 

i get the following error:

 

Code:
1. The method getEMail() is undefined for the type Object
value = (java.lang.String)((((java.lang.Object)field_user.getValue()).getEMail()));
<------>

 

i declared the Field user as object

Code:
[code]<field name="changeUser" class="java.lang.Object"/>

 

i have the same Problem access the "length()" function of an array in a Textfield.

 

Any Ideas?

 

thx in advance!,

 

midrag

Link to comment
Share on other sites

Hi,

 

Why do you declare the field of type Object, if it is of type User? If you want to call methods on it, then you either declare it of the appropriate type or make a cast in the expression.

Also, I think the problem is with the property name because it starts with two upper case characters (EMail).

Have you tried to name your field user.EMail?

 

I hope this helps.

Teodor

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