Beast Mode Case Excluding Certain Strings

Domomon
Domomon Minneapolis, Minnesota ⚪️

I'm trying to build a beast mode that outputs a value when one string of text is found and another string is NOT found. How do you do that in Beast mode? See example of what I'm trying to do down below. I included that minus in front of the semi to indicate that I do not want that string of text to be included.


CASE

WHEN `campaign` LIKE '%online%' THEN 'Online'

WHEN `campaign` LIKE '%residential%' AND `ga_campaign` LIKE -'%semi%' THEN 'Residential' 

ELSE 'Other'

END

Tagged:

Answers

  • @Domomon the syntax is NOT LIKE when you want to be sure it's not anywhere in the string.

    So:

    CASE

    WHEN `campaign` LIKE '%online%' THEN 'Online'

    WHEN `campaign` LIKE '%residential%' AND `ga_campaign` NOT LIKE '%semi%' THEN 'Residential' 

    ELSE 'Other'

    END