Hello,
I am using an xml file as my datasource. One of my fields is a comma delimited list which I split and put into an array.... I have a variable assigned for each array element... so, $V{hr1} = $V{vends}[0]... $V{hr2} = $V{vends}[1]....
I want to take some of my variables and add them together.
$V{hr1} + $V{hr2} + $V{hr3}
My array is defined as a string. I've tried a couple of different options of defining my variables hr1, hr2, hr3.... as integers..... as well as I've tried them as string but nothing works to be able to add them together. I can get it to concatenate the values of hr1, hr2 and hr3 but I cannot get them to add.
I have a variable $V(hr_int4) where the expression is
Integer.valueOf($V{hr1} + $V{hr2} + $V{hr3})
when I view this I see the concatenated values of the fields as if they were strings.
I've tried
Integer.parseInt($V[hr1} + $V{hr2} + $V{hr3})
it didn't work..... I get an error "Incompatible conditional types int + Integer".
I've also gotten the error "The operator + is undefined for the argument type(s) java.lang.Integer, java.lang.Integer.
If anyone can tell me what I am missing doing, it would be greatly appreciated.
Thanks you in advance.
I am using an xml file as my datasource. One of my fields is a comma delimited list which I split and put into an array.... I have a variable assigned for each array element... so, $V{hr1} = $V{vends}[0]... $V{hr2} = $V{vends}[1]....
I want to take some of my variables and add them together.
$V{hr1} + $V{hr2} + $V{hr3}
My array is defined as a string. I've tried a couple of different options of defining my variables hr1, hr2, hr3.... as integers..... as well as I've tried them as string but nothing works to be able to add them together. I can get it to concatenate the values of hr1, hr2 and hr3 but I cannot get them to add.
I have a variable $V(hr_int4) where the expression is
Integer.valueOf($V{hr1} + $V{hr2} + $V{hr3})
when I view this I see the concatenated values of the fields as if they were strings.
I've tried
Integer.parseInt($V[hr1} + $V{hr2} + $V{hr3})
it didn't work..... I get an error "Incompatible conditional types int + Integer".
I've also gotten the error "The operator + is undefined for the argument type(s) java.lang.Integer, java.lang.Integer.
If anyone can tell me what I am missing doing, it would be greatly appreciated.
Thanks you in advance.