I m trying to get myself used to iReport
before using it in a real project next week and i seem to be stacked somewhere already. I m using iReport
3.7.0 on Windows XP platform + Java 1.6
It sound easy to get a field color changed based on what it contains or calculate a sum of number in a field based on conditions but in practice it s taking me too much time to accomplish. I have a query say :
SELECT COUNT(gender) AS total_by_gender, gender, account_status FROM user_account ua, user_profile up WHERE ua.user_profile_id=up.user_profile_id GROUP BY gender,account_status
it gives me something like this:
| total_by_gender | gender | account_status | | 160 |Female | ENABLED | | 26 |Female | UNCONFERIMED | | 100 |Male | ENABLED | | 10 |Male | UNCONFIRMED |
Now I want the ENABLED
Text to Look say green
and UNCONFIRMED
say `red. For that I added a text field with this expression
$F{account_status}.equals( new String("ENABLED") ) ? "<style forecolor= #ff0000 >" + $F{account_status}.toString() + "</style>" :"<style forecolor= #999999 >" + $F{account_status}.toString() + "</style>"
//i ve tried this too
$F{account_status}.contentEquals( new String("ENABLED") ) ?
//and even
($F{account_status}.toString =="ENABLED" ) ?
well for each of them it gives me something like the same text like <style>
(i think it s printing all the condition expression) instead of colored text unconfirmed
or enabled
.
My second problem is that i want to do the total of all unconfirmed
and all enabled
. i can do normal sum expression but with condition i don t have any idea.
Can anyone shed some light? thanks for reading