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.

[SOLVED] Excluding related entries …

December 13, 2011 6:02am

Subscribe [3]
  • #1 / Dec 13, 2011 6:02am

    tinyv

    11 posts

    I have a weblog called ‘reviews’ which has a Related Entries custom field.
    I was just wondering if it is at all possible to perform an entries query against this weblog that excludes all entries which have a relationship from the results.

    Any thoughts on the matter?

    Thanks in advance,

    Cole

  • #2 / Dec 13, 2011 6:50am

    Dom Stubbs

    156 posts

    I would guess that you could use custom field searching for this. Off the top of my head I’m not sure how EE stores relationship data, but if you take a look at your DB you’ll be able to see what the standard value is for a field which hasn’t got a relationship setup (blank or 0 would be a guess). You could then do something like this in your exp:channel:entries tag:

    search:relfield="=0"
    OR
    search:relfield="IS_EMPTY"
  • #3 / Dec 13, 2011 6:59am

    tinyv

    11 posts

    Great Dom, thanks.

    The

    search:relfield="=0"

    fixes it.
    Had tried IS_EMPTY but hadn’t thought to check to see if the related entries were being stored as an integer (thus returning a 0).

    Thanks for the help.

    Cole

  • #4 / Dec 13, 2011 7:20am

    Dom Stubbs

    156 posts

    No problem, glad to hear that sorted it.

  • #5 / Dec 13, 2011 8:49pm

    Sean C. Smith

    3818 posts

    tinyv, glad you found a solution.

    Dom, thanks for the assist. It’s really appreciated.

    Sean

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

ExpressionEngine News!

#eecms, #events, #releases