complex-event-processingesper

Esper epl case statement - can you say if X is in (A, B or C) then Y


create expression getID {
  X =>
    case
        when X in (A, B, C) then Y
    end
};

This is what I want but I don't know if it is possible or what the syntax is?


Solution

  • You already got it.

    create schema Event(location string, sensor string);
    
    create expression getID {
      X =>
        case
            when X in ('A', 'B', 'C') then 'Y'
        end
    };
    
    select getID(location) from Event;