joannem Posted March 7, 2008 Share Posted March 7, 2008 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 More sharing options...
kurosa Posted March 7, 2008 Share Posted March 7, 2008 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 More sharing options...
joannem Posted March 7, 2008 Author Share Posted March 7, 2008 Thank you so much! That worked perfectly! I didn't realize I could just add the [] at the end of java.lang.String!!! Link to comment Share on other sites More sharing options...
Solution Tom C Posted March 8, 2008 Solution Share Posted March 8, 2008 Just FYI... split() is a Javascript method that split a string into an array of stings.For detail, please take a look at http://www.w3schools.com/jsref/jsref_split.asp Link to comment Share on other sites More sharing options...
dunialebah7 Posted January 29, 2014 Share Posted January 29, 2014 What I have to do if I want to display all array values? Link to comment Share on other sites More sharing options...
aypatel90 Posted March 10, 2014 Share Posted March 10, 2014 To dunialebah7: You can use $V{variable}[Report_Count] with above procedure to display the whole array. Link to comment Share on other sites More sharing options...
JRFerreira Posted February 10, 2017 Share Posted February 10, 2017 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now