Jump to content
Changes to the Jaspersoft community edition download ×

Bean - accessing child object in collection


2005 IR Help

Recommended Posts

By: toshi - ilove3c

Bean - accessing child object in collection

2004-08-31 18:02

Hi all,

 

How do you access from the report a field of "child" object in

a collection? That is, if I have two classes, namely Parent

and Child, and:

 

class Parent implements java.io.Serializable {

 

private String name;

private ArrayList childList; // will hold zero or more Child class object

 

public String getName() {

return name;

}

...

...

} // end of class Parent

 

class Child implements java.io.Serializable {

 

private String name;

 

public String getName() {

return name;

}

} // end of class Child

 

, then I can access parent name with $F{name}. But how can I

access the name of child object? $F{childList}.name or something?

 

Thank you for your help!

 

- D

 

 

 

 

By: Michael Bauer - mbabauer

RE: Bean - accessing child object in collection

2004-09-01 09:49

I haven't tried this, but I have seen similar behavior in dealing with columns that have the table name dot-appended to the front, like table.column. Anyway, when you specify the field name of $F{table.column}, the java code produced looks something like:

params_val_table.column.toString()

Or something along those lines. In other words, the '.' becomes part of the var name. You should then be able to use this to your advantage, like:

$F{myBean.arrayList.get(1)}

which should produce something like:

params_val_myBean.arrayList.get(1).toString()

 

Try that and see if that works. If not, then I wish you luck.

Link to comment
Share on other sites

  • 1 year later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

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