Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can create and use scriptlet or you can use expressions like in this samples:</p> <ul> <li>Using national locale (<strong><code>ms_MY</code></strong>, malaysia):</li> </ul> <pre class="lang-xml prettyprint-override"><code>&lt;field name="currentDate" class="java.sql.Timestamp"/&gt; ... &lt;textField&gt; &lt;reportElement x="300" y="0" width="100" height="20"/&gt; &lt;textElement/&gt; &lt;textFieldExpression&gt;&lt;![CDATA[(new DateFormatSymbols(new Locale("ms", "MY")).getMonths())[$F{currentDate}.getMonth()]]]&gt;&lt;/textFieldExpression&gt; &lt;/textField&gt; </code></pre> <ul> <li>Using conditional <em><code>? :</code></em> operator</li> </ul> <pre class="lang-xml prettyprint-override"><code>&lt;field name="currentDate" class="java.sql.Timestamp"/&gt; ... &lt;textField&gt; &lt;reportElement x="200" y="0" width="100" height="20"/&gt; &lt;textElement/&gt; &lt;textFieldExpression&gt;&lt;![CDATA[$F{currentDate}.getMonth() == 0 ? "Januari" : $F{currentDate}.getMonth() == 1 ? "Februari" : $F{currentDate}.getMonth() == 2 ? "Mac" : $F{currentDate}.getMonth() == 3 ? "April" : $F{currentDate}.getMonth() == 4 ? "Mei" : $F{currentDate}.getMonth() == 5 ? "Jun" : $F{currentDate}.getMonth() == 6 ? "Julai" : $F{currentDate}.getMonth() == 7 ? "Ogos" : $F{currentDate}.getMonth() == 8 ? "September" : $F{currentDate}.getMonth() == 9 ? "Oktober" : $F{currentDate}.getMonth() == 10 ? "November" : $F{currentDate}.getMonth() == 11 ? "Disember" : "Unknown" ]]&gt;&lt;/textFieldExpression&gt; &lt;/textField&gt; </code></pre> <ul> <li>You can read <a href="http://jasperreports.sourceforge.net/sample.reference/scriptlet/index.html#scriptlet" rel="nofollow">this article</a> how to use <em>scriptlet</em>.</li> </ul>
 

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