Jump to content
JasperReports Library 7.0 is now available ×

Map DB values to strings


topred

Recommended Posts

Hi,

I've checked the documentation and forums but haven't been able to find an answer so far.

 

I have a database with an integer Status column. The Java code normally takes care of mapping the numeric value to a string value, such as 1="Ready", 2="In Progress", etc. However, I want to generate a JasperReport with the string values, not the integers. I'm using a JRResultSetDataSource for the data.

 

How do I perform this mapping? Thanks.

 

Bob

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Any suggestions? It seems like some of the options are conditional expressions, resource bundles, or parameters, but I expect someone has already solved this in an intelligent way. Also, I want to keep it simple when using iReports. Thanks.

 

Bob

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

I guess it is about: "where to store this relationship between numbers and texts".

Well, you already seemed to find some answers, which should work pretty good.

I like the resource bundle approach.

 

Otherwise you could just create an utility static method somewhere in your application that takes an integer and returns a string and use it in your JRXML.

 

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