Jump to content
Changes to the Jaspersoft community edition download ×

Static variables and arrays in Jasper?


2005 IR Help

Recommended Posts

By: Nishant Miglani - nishantm

Static variables and arrays in Jasper?

2004-04-12 12:59

Hi all,

 

I need to accomplish something similar to the following in my report:

 

Account 1 number: 123

Account 2 number: 456

.

.

 

 

I'm using a custom datasource.

 

I figured using a static variable as the account index would help me solve part of the issue.

 

Now the bunch of account numbers themselves need possibly an array, Vector, ArrayList, or something else. I can get them as fields under java.lang.Object.

 

Now my questions are:

1) Are static variables permitted in Jasper? If so, how to declare and use them? If not, what are the alternatives in this context?

 

2) Can I just call methods on a non-primitive field like an array or a vector? Are there any requirements/restrictions for this?

 

Thanks

 

 

 

 

By: David Lim - aberrant80

RE: Static variables and arrays in Jasper?

2004-04-12 21:34

You need to clarify something first.

 

Are you saying that the account number index does not come from the database but you want some sort of counter?

 

Since you're using a custom data source, can't you just create a variable inside your custom data source that increments itself for every next() that's called?

 

Again, since you're using a custom data source, there's nothing stopping you from using arrays (or anything else). You can simply implement your next method to access an array index depending on a mapping of field names to the indices.

 

 

 

 

 

By: David Lim - aberrant80

RE: Static variables and arrays in Jasper?

2004-04-12 21:37

oops, the last line should read ".... simply implement your getFieldValue method to access ..."

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