+ Start a Discussion
GhilliGhilli 

CASE Funtion with checkbox values

Hi Friends,

 

IMAGE(
CASE(Marked_for_deletion__c,
"FALSE", "/img/samples/light_green.gif",
"TRUE", "/img/samples/light_red.gif",
"/s.gif"),
"Marked For Deletion Flag")

 

 

Here Marked_for_deletion__c is a checkbox. so i used TRUE and FALSE in the case functions.

But its showing error Like " Error: Incorrect argument type for function CASE(). "

 

Kindly help me out in this.

 

Thanks.

a.schaefera.schaefer

From the documentation:
CASE functions cannot contain functions that return true or false.
Since a checkbox is a simple true/false element, the 'else_result' is useless and the following statement is also more compact:

 

IMAGE(
IF(Marked_for_deletion__c, "/img/samples/light_red.gif", "/img/samples/light_green.gif" ), "Marked For Deletion Flag")

HTH - Andreas

 

phil.adams1.3928016499835732E12phil.adams1.3928016499835732E12
This is very late but I found this post whilst searching for this issue - my solution was to use 1 and 0 in the If statements included in the CASE statament and then wrap that in an IF statament that returns True/False, a bit like the following;

IF( 
  CASE( FieldA__c, 
    "ABC", IF( FieldB__c = 10.82, 1, 0),
    "DEF", IF( FieldB__c = 91.78, 1, 0),
    0),
TRUE, FALSE)

Nishant Kumar 107Nishant Kumar 107
IF(
   CASE(TEXT(Rating),
         "Hot", IF(ISBLANK(Title),1,0),
         "Warm",IF(CONTAINS(Title, "NK"),1,0),
         0),
TRUE,FALSE)

Gives error: Incorrect parameter type for function 'IF()'. Expected Boolean, received Number
Matt Nelson 19Matt Nelson 19
^ correct, CASE will result in the number 1/0 not boolean, so it has to be compared with the number 1:

 
IF(
  CASE(TEXT(Rating),
    "Hot", IF(ISBLANK(Title),1,0),
    "Warm",IF(CONTAINS(Title, "NK"),1,0),
    0)
    =1,
TRUE,FALSE)