Syntax error in beast mode case statement

Hi,

 

I'm new to domo and struggling a bit on what seem fairly simple issues so apologies if this is a stupid question.

 

I am using a Case statement in Beast mode to try and return the number 1 if certain criteria are met.   I've managed to return the number 1 as text so far but need to return it as a number rather than text.    When I remove the quote marks from around the 1s it gives me a syntax error.

 

CASE
When `Stage` = 'Cancelled' THEN 1
When `Stage` = 'Rejected' THEN 1
When `Stage` = 'Not Interested' THEN 1
When `Stage` = 'Invited to Apply' THEN 1
Else ''
end

 

Thanks!

Best Answer

  • RGranada
    RGranada Contributor
    Answer ✓

    Hi,

     

    I think your problem is the ELSE clause, you are returning different data types. You should Return Null Or 0.

     

    Null Example :

     

    CASE
    When `Stage` = 'Cancelled' THEN 1
    When `Stage` = 'Rejected' THEN 1
    When `Stage` = 'Not Interested' THEN 1
    When `Stage` = 'Invited to Apply' THEN 1
    Else 

    IFNULL(1,1)
    end

     

     

    Zero Example:

     

    CASE
    When `Stage` = 'Cancelled' THEN 1
    When `Stage` = 'Rejected' THEN 1
    When `Stage` = 'Not Interested' THEN 1
    When `Stage` = 'Invited to Apply' THEN 1
    Else 0
    end

     

    Hope this helps.

    Ricardo Granada 

    MajorDomo@Lusiaves

    **If the post solves your problem, mark it by clicking on "Accept as Solution"
    **You can say "Thank you" by clicking the thumbs up in the post that helped you.

Answers

  • RGranada
    RGranada Contributor
    Answer ✓

    Hi,

     

    I think your problem is the ELSE clause, you are returning different data types. You should Return Null Or 0.

     

    Null Example :

     

    CASE
    When `Stage` = 'Cancelled' THEN 1
    When `Stage` = 'Rejected' THEN 1
    When `Stage` = 'Not Interested' THEN 1
    When `Stage` = 'Invited to Apply' THEN 1
    Else 

    IFNULL(1,1)
    end

     

     

    Zero Example:

     

    CASE
    When `Stage` = 'Cancelled' THEN 1
    When `Stage` = 'Rejected' THEN 1
    When `Stage` = 'Not Interested' THEN 1
    When `Stage` = 'Invited to Apply' THEN 1
    Else 0
    end

     

    Hope this helps.

    Ricardo Granada 

    MajorDomo@Lusiaves

    **If the post solves your problem, mark it by clicking on "Accept as Solution"
    **You can say "Thank you" by clicking the thumbs up in the post that helped you.
  • Thanks Ricardo, that worked perfectly.

This discussion has been closed.