Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.

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?

Thankyou!!
1 answer
  1. Jul 14, 2015, 2:49 PM
    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.

     
0/9000