megotronx Posted June 6, 2007 Share Posted June 6, 2007 Hey thereI`m new with this reporting toolSo i have database fields with values of strings(c13,c14,c15,c16)but these string values are numbers.("3","2","1")And i need to sum all these fields values.In report i need to see c13+c14+c15=3+2+1=6 i created variables with expressions:$F{C21}==null ? "0" : $F{C21}and then used the Integer.valueOf($V{c16}) but it doesn`t worked.String and integers conflictPost edited by: megotronx, at: 2007/06/11 13:05 Link to comment Share on other sites More sharing options...
codyjasperForge Posted July 5, 2007 Share Posted July 5, 2007 you cannot test the condition $F{C21}== null. Even though it will work outside of iReport,(for reasons I do not know) this test will fail when used in a variable/group/textfield/printwhen expression. You should just convert your strings into ints first, then do the addition... c13.intValue() + c14.intValue() + c15...etc Make sure that the textfield you are using has the correct class defined as well. (Don't define a String textfield and feed it int's) Hope this helps... Link to comment Share on other sites More sharing options...
singhipst Posted July 6, 2007 Share Posted July 6, 2007 We also faced the same problem here i wanted to show data in specific pattern and if data is not there then it has to print NO_DATA the problem was if i use text field class double then i can't print NO_DATA and if i make it string then i can't achive result in desire pattern format. We created java class for this it will take value and always return string data type if its null then it returns NO_DATA else formated value in string formate. Hope it will be helpfull for others Regards:Ritesh Kumar 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