Jump to content
We've recently updated our Privacy Statement, available here ×

Using arrays in iReport


joannem
Go to solution Solved by Tom C,

Recommended Posts

Hi,

 

I am using an xml datasource which contains a field I need to reference. The field value is a comma delimited list (0,0,1,0,2,255,0). I need to be able to separate the values as each entry in the list represents an hourly value. I can use split to put the value in an array but then I'm not sure how to access the individual array values.

 

Anyone know a way for me to do this?

 

Thanks!

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

i was in same situation right now.

 

create Variable that the data type 'java.lang.String[]' or Integer[]

 

the data type you can select is only String/Integer, so add [] after String/Integer

 

Then write variable expression

$F{array}.split(,)

 

after that, text field expression is $V{variable}[0].

 

does it help you?

Link to comment
Share on other sites

  • 5 years later...
  • 1 month later...
  • 2 years later...

Hi there,

 

I have the same proble, but i'm using jasper Studio.

I created a variable with:

 - Valude Class Name: java.lang.Srting[]

- Expression: $F{array field}.split(',')

 Then at cell table i put $V{variable name}[0]

 

When i try ti generate the previes gives this error:

Error evaluating expression for source text: $F{modelo}.split(', ')

 

I need some help here. :

 

 

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