Jump to content
JasperReports Library 7.0 is now available ×

Field Naming Convention -- Custom DataSource


2005 IR Help

Recommended Posts

By: Nishant Miglani - nishantm

Field Naming Convention -- Custom DataSource

2004-04-07 08:42

Hi all,

 

I am using a custom datasource with my report. Some fields are populating without problem. Other +fields, that actually belong to contained classes within the datasource object, are not populating at all.

 

Now, I know there is some sort of naming convention when dealing with contained fields, which is prepending the class name to the field name, and capitalizing the field name. I am doing this and having trouble, so I'm obviously missing something.

 

Also, in the extra documentation written by Teodor, it says:

 

"By using this optional <fieldDesciption> element, you could easily overcome restrictions

regarding the field naming conventions, using the field description instead of the field name, when

retrieving the field values from the data source."

 

So my questions are these:

1) What are the field naming conventions for a custom datasource - especially for fields from contained classes?

2) How do you use the field description to overcome them? An example would be very useful.

 

Thanks

 

 

 

 

By: Nishant Miglani - nishantm

RE: Field Naming Convention -- Custom DataSource

2004-04-07 14:37

Does anybody know the answer to this? Teodor?

 

 

 

 

By: Teodor Danciu - teodord

RE: Field Naming Convention -- Custom DataSource

2004-04-10 04:25

 

Hi,

 

We can talk about naming conventions only in the

data source implementations that come with the

library, such as the JRResultsSetDataSource which

takes the report field name and tries to find a

column with the same name in the ResultSet.

The JRBeanCollectionDataSource uses the

JavaBeans get/set naming conventions to call by

reflection the get methods on the JavaBean objects

inside the data source.

 

But if you are talking about "custom" data source

implementation, it means you have full control

and that you can make any naming convention

you like, as long it is you who will implement the

JRDataSource interface and extract the field value.

 

However, the only limitation comes from the fact

that the report name should be a Java identifier

(no dots or comas or other characters like that).

To overcome this, the field description was added

so that you could use it in your custom

implementation of the JRDataSource.

 

I hope this helps.

Teodor

 

 

 

 

 

By: Nishant Miglani - nishantm

RE: Field Naming Convention -- Custom DataSource

2004-04-12 08:32

It certainly did help. My problem is fixed.

 

Thanks Teodor!

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

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