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.

Multiple not IS_EMPTY parameters on channel:entries

August 10, 2011 12:58pm

Subscribe [3]
  • #1 / Aug 10, 2011 12:58pm

    Jon @ Kernel

    122 posts

    Just a quickie - is there any way to use this on multiple custom fields:

    search:custom_field="not IS_EMPTY"

    So, if either file_relationship_event OR file_relationship_conference have content, then show the entry:

    In mangled EE code:

    {exp:channel:entries channel="memberarea" orderby="date" dynamic="off" search:file_relationship_event="not IS_EMPTY" OR search:file_relationship_conference="not IS_EMPTY"}
        {title}
    {/exp:channel:entries}

    Alternatively, if this needs the query module - any tips on code for that one?

    Thanks!

  • #2 / Aug 11, 2011 4:48am

    John Henry Donovan

    12339 posts

    Hi Jon,

    Is it a standard relationship field or Playa or similar?

    You could just use a conditional for the existence of a 0 value which is the default for a relationship field

    {exp:channel:entries channel="memberarea" orderby="date" dynamic="no"}
        {if file_relationship_event != '0' OR file_relationship_conference != '0'}
         {title}
        {/if}
    {/exp:channel:entries}

    Does that help?

  • #3 / Aug 11, 2011 12:48pm

    Jon @ Kernel

    122 posts

    Thanks John - It’s 2 Playa fields, actually.

    I hadn’t thought of that because I only want to output 1 entry (limit=1), and show the entry (an event/conference) the resource in the memberarea channel is related to so figured that would be quite an inefficient of doing it? 

    Since not every entry in memberarea holds a relationship with an entry, I can’t use ‘limit=1’ on the channel entries tag with that method, as the first entry might not hold a relationship.

    Essentially, we’re looking to:

    Show first entry in channel="memberarea" where file_relationship_event OR file_relationship_conference !="" and only output 1 result for this query
  • #4 / Aug 13, 2011 5:35pm

    Dan Decker

    7338 posts

    Hi Jon,

    In the scenario you describe, you might have to let {ep:channel:entries} retrieve more than 1 entry, and then apply your logic via John Henry’s suggested conditionals, and then use Playa’s limit parameter to achieve the results you are looking for. However, I have no experience with Playa so that’s all conjecture on my part, after reading through the Playa docs.

    Cheers,

  • #5 / Aug 14, 2011 9:09pm

    Jon @ Kernel

    122 posts

    Thanks guys - we fiddled around with things a little bit and simplified the process a bit. 

    The queries were a bit too memory intensive to be worth it, really, but we do at least have something that does the trick, based on a little bit of your suggestion, John!

  • #6 / Aug 15, 2011 4:09am

    John Henry Donovan

    12339 posts

    Good stuff! Feel free to start a new thread if you have any more questions.

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

ExpressionEngine News!

#eecms, #events, #releases