+ Start a Discussion
IT Admin DeloitteIT Admin Deloitte 

Override controller result in a visualforce page

Hi All,

I've got a Visualforce page that shows a table with numbers in it. Numbers are calculated in the controller and saved in variables like Decimal division.
Then are called in the visualforce with {!division}.
The division can have as result a positive number, 0 or impossible. In the controller, when the division is impossibile, it is forced in the variable division the number -1.
I would like to show in the visualforce the symbol " - " only when {!division}​ is equal to -1. I cannot do it in the controller because it is Decimal.

Any idea?


Chamil MadusankaChamil Madusanka
Try it like this in the visualforce page.
{!IF(division == -1,'-', division)}

If you get the answer, please mark it as the correct answer. It will be a help to others who are facing the same problem later.