Is there any way to set a default value to a field in a report? I have a lot of String fields in a report and would like them to display "0,00" when they're null.
If the "Blank when null" is checked and its contains static text inside the text field the database fields ($F{}) will return null (if the field has no value). I could use a NVL(test,' '), but the space will be underlined.
Supposing the field name is "value", in the "Text Field Expression", write:
($F{value} != null) ? $F{value} : "0.00"
You can also select "Blank when null" in the properties of the text field if you want that. Other options are more flexible but this does the trick very quick and easy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With