ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Channel entries search for IS_EMPTY on a date field (I know date fields are not 'searchable')

August 29, 2012 3:05am

Subscribe [2]
  • #1 / Aug 29, 2012 3:05am

    ipixel (Australia)

    158 posts

    Now I preface with the knowledge that Date fields are not supported by the exp:channel:entries search parameter, but in my case, I’m attempting to display a list of entries where a specific custom date field is actually empty (ie. is yet to be set).

    This is the code I’m using:

    {exp:channel:entries
        channel="members"
        dynamic="off"
        status="Open"
        search:cf_members_card_printed_date="IS_EMPTY"
        category_group="11"
        group_id="8"
        limit="50"
    }

    Now I’ve had a squizz at the channel module code and can’t seem to find any fieldtype checking for this parameter per se, so wondering why if the field data doesn’t exist, why the above would be returning nothing. I guess the real question is, does the channel entries tag really exclude any date fieldtypes specifically.

    Thanks
    Brendan

  • #2 / Aug 29, 2012 5:08pm

    Shane Eckert

    7174 posts

    Hey Brendan,

    Good question.

    The answer took a bit of digging into the code and testing. I appreciate questions like this.

    So basically the field is not empty, since it’s a date there is a 0 entered. So searching for IS_EMPTY will no work since there is actually a value in the date field.

    I hope this helps. Anything else I can help you with?

    Cheers,

  • #3 / Aug 30, 2012 10:11pm

    ipixel (Australia)

    158 posts

    Shane

    That did the trick. Changing the search parameter to check for ‘0’ instead gives me the desired returned listing:

    {exp:channel:entries
    channel="members"
    dynamic="off"
    status="Open"
    search:cf_members_card_printed_date="=0"
    category_group="11"
    group_id="8"
    limit="50"
    }

    Thanks again.

    Cheers
    Brendan

  • #4 / Aug 31, 2012 2:27pm

    Shane Eckert

    7174 posts

    Hey Brendan,

    Glad to hear it!!!

    If you need anything else, please just let me know by opening a new thread.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases