Note that there are some explanatory texts on larger screens.

plurals
  1. POField Expression in iReport
    text
    copied!<p>I'm trying to get myself used to <code>iReport</code> before using it in a real project next week and i seem to be stacked somewhere already. I'm using <code>iReport</code> 3.7.0 on Windows XP platform + Java 1.6 </p> <p>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 :</p> <pre class="lang-sql prettyprint-override"><code>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 </code></pre> <p>it gives me something like this:</p> <pre> | total_by_gender | gender | account_status | | 160 |Female | ENABLED | | 26 |Female | UNCONFERIMED | | 100 |Male | ENABLED | | 10 |Male | UNCONFIRMED | </pre> <p>Now I want the <code>ENABLED</code> Text to Look say <code>green</code> and <code>UNCONFIRMED</code> say `red. For that I added a text field with this expression </p> <pre><code>$F{account_status}.equals( new String("ENABLED") ) ? "&lt;style forecolor='#ff0000'&gt;" + $F{account_status}.toString() + "&lt;/style&gt;" :"&lt;style forecolor='#999999'&gt;" + $F{account_status}.toString() + "&lt;/style&gt;" //i've tried this too $F{account_status}.contentEquals( new String("ENABLED") ) ? //and even ($F{account_status}.toString =="ENABLED" ) ? </code></pre> <p>well for each of them it gives me something like the same text like <code>&lt;style&gt;</code> (i think it's printing all the condition expression) instead of colored text <code>unconfirmed</code> or <code>enabled</code>.</p> <p>My second problem is that i want to do the total of all <code>unconfirmed</code> and all <code>enabled</code>. i can do normal sum expression but with condition i don't have any idea. Can anyone shed some light? thanks for reading</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload