daad.madhusudan Posted July 1, 2015 Share Posted July 1, 2015 I am working on a jasper report in which I am using following SQL query: select SOURCE, count(*) as total from CASE_UPLOADS where UPLOAD_DT >= '20150601' and UPLOAD_DT <= '20150630' group by SOURCE order by SOURCE and the result is: SOURCE,TOTAL "New Application";15 "Periodic Report";16 "RD/RC";25 I have created variable like: <variable name="PR" class="java.lang.Integer" calculation="Sum"> <variableExpression><![CDATA[($F{source} == 'Periodic_Report') ? $F{total} : 0]]></variableExpression> </variable> This variable is printing zero value each time. If I change conditional clause as follow: <variable name="PR" class="java.lang.Integer" calculation="Sum"> <variableExpression><![CDATA[($F{source} == 'Periodic_Report') ? 0 : $F{total}]]></variableExpression> </variable> Then its printing SUM 56 of TOTAL column. Can someone please tell me what is wrong here? Link to comment Share on other sites More sharing options...
sanbez Posted July 1, 2015 Share Posted July 1, 2015 Why you wrote at jaspersoft and stackoverflow the same wrong (uncorrect) question? You can't get right answer with this description.You're wasting people's time. You must correct mistakes and show fields declarations. And show result with $F{source}.equals("Periodic Report") Link to comment Share on other sites More sharing options...
hozawa Posted July 2, 2015 Share Posted July 2, 2015 Should be using ".equals(object)" if you're using Java as your report language. 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