0

What I am trying to accomplish is a timeline view, the timeline results are spread over multiple entries, however all of those entries are linked by a field that has a matching id.

For Example

Channel :: notes ID Field :: notes_intake_id

Channel :: contact_log ID Field :: contact_log_intake_id

{exp:channel:entries channel="contact_log|notes" search:contact_log_intake_id="={segment_4}" search:notes_intake_id="={segment_4}" dynamic="no"}
    <div class="timeline-item">
        <div class="row">
            <div class="col-xs-2 date">
                <i class="fa fa-{if "{channel_name}" == "contact_log"}comments{if:elseif "{channel_name}" == "notes"}file{/if}"></i>
                {entry_date format="%i:%g %a"}
                <br/>
                <small class="text-navy">{entry_date:relative} </small>
            </div>
            <div class="col-xs-10 content no-top-border">
                <p class="m-b-xs"><strong>{channel_name} - {title}</strong></p>
                {if "{channel_name}" == "general_release"}
                    external-link
                {if:elseif "{channel_name}" == "contact_log"}
                    comments
                {/if}
            </div>
        </div>
    </div>
{/exp:channel:entries}

With the search parameters i am getting no results.

Here is a screenshot of what it looks like without the search parameters. https://www.dropbox.com/s/kh5cs6ichf6f384/Screenshot%202014-11-06%2007.34.48.png?dl=0

In summary I'd like to pull channel data from multiple channels and filter them by different custom fields for each channel by the same value

2 Answers 2

1

Without testing your code, I suspect you are getting No Results thanks to both of your search parameters needing to be found, and by definition, this is impossible, because neither channel has both of these values as fields at the same time.

This appears to be a job for Stash Lists. You can create lists with Stash, append whatever, and sort them however, including by the common field between both sets of answers. You can add both sets of channel listings to a list one at a time, naming values with new variables and mashing them up however you'd like.

Stash can be a challenge to work with if you never have worked with it before, but community support (free) and developer support (paid) is available. You may want to be sure you have the time to invest.

2
  • I appreciate the reply however i found a solution. Nov 6, 2014 at 19:43
  • There's always custom queries! Nov 6, 2014 at 20:58
1

Here is the solution to my question. Instead of using the search parameter i wrote a single result query around my channel entries tag and passed the concatenated entry_id's in the entry_id parameter Separated by | that allowed me to loop through all the entries for each channel.

{exp:query sql="Select GROUP_CONCAT(CONVERT(entry_id, CHAR(8)) SEPARATOR '|') as eid from exp_channel_data WHERE field_id_459 = '{embed:iid}' OR field_id_192 = '{embed:iid}' OR field_id_193 = '{embed:iid}' OR field_id_165 = '{embed:iid}' OR field_id_497 = '{embed:iid}' OR field_id_195 = '{embed:iid}' OR field_id_196 = '{embed:iid}'"}
    {if "{eid}" != ""}
    {exp:channel:entries channel="general_release|contact_log|notes|medicine_log|temperature_log|bottle_feeding_log" entry_id="{eid}" dynamic="no"}
        <div class="timeline-item">
            <div class="row">
                <div class="col-xs-2 date">
                    <i class="fa fa-{if "{channel_name}" == "general_release"}external-link{if:elseif "{channel_name}" == "contact_log"}comments{if:elseif "{channel_name}" == "notes"}file{if:elseif "{channel_name}" == "medicine_log"}medkit{if:elseif "{channel_name}" == "temperature_log"}stethoscope{if:elseif "{channel_name}" == "bottle_feeding_log"}tint{/if}"></i>
                    {entry_date format="%g:%i %a"} - {embed:iid}
                    <br/>
                    <small class="text-navy">{entry_date:relative}<br>{entry_date format="%m/%d/%Y"} </small>
                </div>
                <div class="col-xs-10 content no-top-border">
                    {if "{channel_name}" == "general_release"}
                        <p class="m-b-xs"><strong>General Release</strong></p>
                        <p>Went to {release_destination} for {if "{release_reason}" == "Other"}{release_reason_other}{if:else}{release_destination}{/if}.</p>
                    {if:elseif "{channel_name}" == "contact_log"}
                        <p class="m-b-xs"><strong>Contact</strong></p>
                        <p>Contact was made with {contact_list_relationship:contact_name}.</p>
                    {if:elseif "{channel_name}" == "notes"}     
                        <p class="m-b-xs"><strong>Notes</strong></p>                                        
                        {note}
                    {if:elseif "{channel_name}" == "medicine_log"}      
                        <p class="m-b-xs"><strong>Medication</strong></p>   
                        <p>{amt_given} {medication_relationship:medicine_name} were given.</p>
                    {if:elseif "{channel_name}" == "temperature_log"}
                        <p class="m-b-xs"><strong>Temperature</strong></p>  
                        <p>A temperature of {temperature} was recorded.</p>
                    {if:elseif "{channel_name}" == "bottle_feeding_log"}
                        <p class="m-b-xs"><strong>Bottle Feeding</strong></p>   
                        <p>A bottle was given.</p>
                    {/if}
                </div>
            </div>
        </div>
    {/exp:channel:entries}
    {/if}
    {/exp:query}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.