Filter for (not) empty text field in query

Options

Hi,

I want to have an optional query clause to filter for entries which have a value (strlen greater 0) on a text field.

Unfortunately I am not able to use the strlen filter on the condition/field.

I know I can just leave the value side of the condition empty, but I want to make the where clause conditional by an input parameter.

I know I could just simply copy the whole query and then add a switch/if statement before that. But thats not very elegant I want to avoid such a query/endpoint design.

Any ideas how to solve that?


Tagged:

Best Answer

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Answer ✓
    Options

    So you will still need to uncheck that checkbox to filter your records as described. Ignoring empty values will not abide those empty values to your expression.

    Your boolean input would only come into play in a Conditional (IF...THEN...ELSE) statement.

    IF input: with_text == true

    THEN

    Query all records WHERE db review.review_text = (do not ignore empty values)

    ELSE

    Some other statement

Answers