All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Can I test a field for being not empty?

Daniel Kaminski 6 Aug 2013 07:32 question, complete

Hello,

is there a way with low_search to simply test that a field is not empty?

e.g. doing an exact search in field A and only including entries where field B is not empty

Thanks,
Daniel

Replies

  1. Low 6 Aug 2013 07:37

    You can use any of the search:field_name values, including search:field_name="not IS_EMPTY". In an input field that would mean:

    <input name="search:field_name" value="not IS_EMPTY" />

  2. Daniel Kaminski 6 Aug 2013 07:50

    First of all, thanks for the quick reply.

    It is clear now how to test a field, for not being being, but seeing your answer I wonder how can I control the AND and OR conjunctions?

    What I'm currently doing is, I dynamically build multiple input fields which look all into the same channel field.

    Is there a way to perform a search with the following structure?

    WHERE (field-a contains term1 OR field-a contains term2) AND (field-b is not empty)

    cheers,
    Daniel

  3. Low 6 Aug 2013 10:14

    The same principle applies. These parameters:

    search:field-a="term1|term2" search:field-b="not IS_EMPTY"


    Which translates to input fields like this:

    <input name="search:field-a" value="term1|term2" /> 
    <input name="search:field-b" value="not IS_EMPTY" />


    or

    <input name="search:field-a[]" value="term1" /> 
    <input name="search:field-a[]" value="term2" />
    <input name="search:field-b" value="not IS_EMPTY" />


    Note that I'm using [] behind the input name if it takes multiple values.