+ Start a Discussion
Matt TindallMatt Tindall 

APEX IF statement

Hello,

I am using IF statements to change the colour of text determined on its value. I have it working to show either "RED"  if the value is below 15 and Green thereafter.

 

<font size="6" color="{!IF((ShowNovemberSales<15),"RED","GREEN")}">{!ShowNovemberSales}</font>

 I'd like to add in an extra colour and that is if the value is GREATER than 15 but LOWER than 26 to show orange. 

Can anyone tell me how i write this as im having no luck!

Thanks,

Matt

Best Answer chosen by Admin (Salesforce Developers) 
SeAlVaSeAlVa

Can't you just 

 

<font size="6" color="{!IF(ShowNovemberSales<15,"RED",IF(ShowNovemberSales<26,"ORANGE","GREEN"))}">{!ShowNovemberSales}</font>

 ?

 

(haven't tried)

All Answers

SeAlVaSeAlVa

Can't you just 

 

<font size="6" color="{!IF(ShowNovemberSales<15,"RED",IF(ShowNovemberSales<26,"ORANGE","GREEN"))}">{!ShowNovemberSales}</font>

 ?

 

(haven't tried)

This was selected as the best answer
Andries.NeyensAndries.Neyens

Why not create a getter for this ?

You already have ShowNovemberSales,

Add NovemberSalesColor or something...

Matt TindallMatt Tindall

I kept putting an "!" on the second "IF".

I've been staring at the screen for too long today.

Thanks!!!