+ Start a Discussion
jbroquistjbroquist 

Case statement with picklist expression giving error

In the following case, the field CalendarAvailability__c is a picklist field and Closed, Tenative, & Open are the fields values. I'm trying to have an image displayed in a formula field based on the value of that field but am receiving the following error on save:

 

Error: Syntax error. Missing ')'

 

 But as far as I can tell my Case statement seems to be formatted properly ... what am I missing ...?

 

 

CASE
(
CalendarAvailability__c,
'Closed',
IMAGE('/img/samples/color_red.gif', 'Closed' [, 25, 100]),
'Tenative',
IMAGE('/img/samples/color_yellow.gif', 'Tenative' [, 25, 100]),
'Open',
IMAGE('/img/samples/color_green.gif', 'Open' [, 25, 100]),
' '
)

 

 

 

 

Message Edited by jbroquist on 03-30-2010 06:50 PM
Best Answer chosen by Admin (Salesforce Developers) 
werewolfwerewolf

Those bracket things are just doc artifacts to indicate that those parameters are optional.  You shouldn't actually put them in your formula.  This should work then:

 

CASE
(
    CalendarAvailability__c,
    'Closed',
    IMAGE('/img/samples/color_red.gif', 'Closed' , 25, 100),
    'Tenative',
    IMAGE('/img/samples/color_yellow.gif', 'Tenative' , 25, 100),
    'Open',
    IMAGE('/img/samples/color_green.gif', 'Open' , 25, 100),
    ' '
)

All Answers

werewolfwerewolf

Those bracket things are just doc artifacts to indicate that those parameters are optional.  You shouldn't actually put them in your formula.  This should work then:

 

CASE
(
    CalendarAvailability__c,
    'Closed',
    IMAGE('/img/samples/color_red.gif', 'Closed' , 25, 100),
    'Tenative',
    IMAGE('/img/samples/color_yellow.gif', 'Tenative' , 25, 100),
    'Open',
    IMAGE('/img/samples/color_green.gif', 'Open' , 25, 100),
    ' '
)

This was selected as the best answer
jbroquistjbroquist
I knew it was something stupid like that ... grr ... thanks a bunch!!!