Support Questions
Find answers, ask questions, and share your expertise

case statement on NiFi QueryRecord

case statement on NiFi QueryRecord

New Contributor

Hello everyone.

 

I'm trying to use case statement in QueryRecord SQL but apparently I get it wrong.

 

My SQL is

 

select
    CASE
        WHEN STATUS <> 'DECLINED' THEN 'Some text'
    END ABC
from flowfile

 

then I get (with JSON writer) [{"ABC": "S"}] which is not what I expected (expected is [{"ABC": "Some text"}])

It gets even worse if I try to use non-latin symbols, when I use when ... then 'русский текст' then ff transfers to failure.

 

What am I doing wrong?

Or can I use UpdateRecord instead? With the same logic?