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.

Getting field from a mapped channel.

March 22, 2012 6:46am

Subscribe [2]
  • #1 / Mar 22, 2012 6:46am

    Beertastic

    49 posts

    I’m doing a site for a local bike racing group.
    They have a riders channel that stores all rider info.
    there’s also a team channel, with, you guessed it, team info.

    A request was made to allow the mapping of riders to teams by year.
    As this could go back 20 years and well into the future, I didn’t want to have create heaps of rider channel custom fields with each year created with a relation to the teams channel. The rider form would be crazy long!

    So i made a map_rider_team channel.
    3 fields
    rider relationship to rider channel
    team with relationship to team channel
    and a text input for a year.
    here are my short names:
    52 map_team_driver_id_driver - Relationship
    53 map_team_driver_id_team - Relationship
    54 map_team_driver_year - text

    What I’m trying to do now is list a rider, and then show what teams he was in in what years.

    Here’s my rider template (I’m echoing ID’s so I know what’s going on):

    Driver test page:
    
      {exp:channel:entries channel="driver" limit="1" dynamic="off" orderby="random"}
        {entry_id} - {driver_drivername}
        {embed="gt1/_embed_driver_team" driver_id="{entry_id}"}
      {/exp:channel:entries}

    And my _embed_driver_team template:

    <hr >Teams: (Driver ID: {embed:driver_id})
      {exp:channel:entries channel="map_team_driver" search:map_team_driver_id_driver="{embed:driver_id}"}
      
    Year: {map_team_driver_year}
      {/exp:channel:entries}

    The ID is passing just fine, but I’m getting no results from the map table..
    Can EE even DO this?
    any thoughts would be appreciated… 😊

  • #2 / Mar 22, 2012 9:13am

    glenndavisgroup

    436 posts

    Hi Beertastic,

    This should work. Try adding dynamic=“no” to your embed template.

    Thank you,

    Mike

  • #3 / Mar 22, 2012 9:27am

    Beertastic

    49 posts

    Nope :(
    Cheers though.. I’ll read a few other settings.

  • #4 / Mar 22, 2012 9:31am

    Beertastic

    49 posts

    ah:
    http://ellislab.com/expressionengine/user-guide/modules/channel/channel_entries.html#search-field-name

    Note: Only fields of the type “Text Input”, “Textarea”, and “Drop-down Lists” are searched with this parameter.

    So how can I search relational fields?

  • #5 / Mar 23, 2012 9:48am

    Beertastic

    49 posts

    No clue about this so I’ve opted to simply list 30 odd years as fields (yip, 30 separate custom fields) and buy playa.
    I can now assign each rider to any No of teams per year..
    annoying form for the end user, but it ‘works’..

    :(

  • #6 / Mar 23, 2012 10:53am

    Shane Eckert

    7174 posts

    Hey Beertastic,

    Nice name. 😊

    Glad to see that you got this working. There are also some very nice Search Add-Ons as well that might give you more of what you are looking for. Low’s search Add-On is pretty popular.

    Have a great weekend!

    Cheers!

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

ExpressionEngine News!

#eecms, #events, #releases