Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Display text if zero, otherwise format as currency.
rem955
Hellos again. I have a decimal column that has a few zeroes that pop up in it. I want to change the zeroes to text, like "Paid Off". I also would like to keep the currency format that I have now for the non-zero values. I tried doing this with filters but that didn't work. Any ideas on how to quickly solve this? BIRT is integrated with Spring for the record.
Find more posts tagged with
Comments
bgbaird
I would just place 2 objects in the cell.
Object 1 is the decimal value, hide it if value == 0
Object 2 is a string value, hide it if the decimal value != 0
Brian
kclark
I created a computed column to what you are trying to do. It checks the row PRICEEACH and if the price is over 100 then it displays "Don't Buy" else "Buy"<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if(row["PRICEEACH"] > 100) {
this.text = "test"
}else{
this.text = "buy"
}
</pre>
<br />
I've attached my code for you to look at. So what I would do if I was you is create the computed column and if the value == zero then display "paid off" else set the value to whatever the amount is. Now this won't work if you need to aggregate because it's a string.
kclark
While my last post is one way to do it, I forgot about mapping, if you select the data object > select map from the property editor > select add.
From here you can make an expression that checks if the value is zero, and if it is you can choose what you would like it to show, in this case PAID.