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.

Showing entries with unassigned or non-assigned relationship field

January 22, 2014 9:57pm

Subscribe [1]
  • #1 / Jan 22, 2014 9:57pm

    darien

    5 posts

    Prior to EE 2.6 when the relationship fields were rewritten, this block worked correctly to find child entries (program channel) who were NOT associated with a parent (program parents channel) using the relationship field {program_parent} :

    {exp:channel:entries channel="programs" dynamic="no" status="open" orderby="program_display_order" sort="asc"}
        {if program_parent == "0"}
            <li> {title} </li>
        {/if}
    {/exp:channel:entries}

    Now, in EE 2.7.2, although there are new methods for accessing additional field content in the relationships between an entry in one channel and an entry in another, there appears to be no documented way to identify entries that are NOT associated.

    Does anyone know of a workaround for finding entries whose relationship drop-down contains no value?

  • #2 / Jan 22, 2014 10:13pm

    darien

    5 posts

    After reading this bug report: support.ellislab.com/bugs/detail/19820
    it occurred to me that tests need to be more specific; e.g. to include a specific field. This code appears to do what I want by returning entries without parents.

    {exp:channel:entries channel="programs" dynamic="no" status="open" orderby="program_display_order" sort="asc"}
      {if "{program_parent:url_title}" == ""}
         <li>{title}</li>
      {/if}
    {/exp:channel:entries}

     

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

ExpressionEngine News!

#eecms, #events, #releases