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.

Automatically relating entries

August 06, 2012 6:05pm

Subscribe [2]
  • #1 / Aug 06, 2012 6:05pm

    scottb

    348 posts

    I have two csv files arriving nightly with a lot of information. The files have two fields in common—the same ID number and title—that I need to tie together on the site.

    I understand that relating entries is an option if done manually, but there are too many entries to relate, so it has to be done another way.

    Nothing seems to work when I try relating the entries via segments, conditionals and embedded templates and channels. Can anyone offer a suggestion?

  • #2 / Aug 08, 2012 11:05am

    Lisa Wess

    20502 posts

    Good morning, Scott,

    I am thinking that something with DataGrab to create these relationships might work; but if not - a custom import solution specific to your needs is likely to be the most direct path.  There is simply not a current feature to handle this particular need at this time.

    I am sorry I couldn’t be more help.  I could move this to our community forums if you’d like to seek out input from other community members.  Let me know!

  • #3 / Aug 10, 2012 6:22am

    scottb

    348 posts

    Hi, Lisa. In fact, I’m using DataGrab for the uploads. I haven’t found a way yet to use it that way, but I’ll keep at it. Thanks for the feedback.

  • #4 / Aug 10, 2012 9:56am

    Lisa Wess

    20502 posts

    Sure Scott.  I’m going to move this to our Community Help forums so that others can chime in if they have some ideas.

  • #5 / Aug 11, 2012 11:39am

    John St-Amand

    865 posts

    It’s hard to know for sure exactly how you want to relate them together, but it seems like it could be as simple as using the search parameter on the entries loop.  So for example, if both sets of CSV imports are in separate channels, then displaying the two of them that share a unique ID imported as part of their respective data sets could be done like this:


    Parent entries loop:

    {exp:channel:entries channel="csv_import1" limit="1" dynamic="no" disable="whatever|can|can|live|without"}
    
    {title}
    
    {other_custom_fields_from_csv_import1}
    
    {embed="embeds/csv_import2" the_csv_import1_id="{csv_import1_id}"}
    
    {/exp:channel:entries}

    Embed entries loop pulling csv_import2 data in that matches csv_import1:

    {exp:channel:entries channel="csv_import2" limit="1" search:cdv_import2_id="={embed:the_csv_import1_id}" dynamic="no" disable="whatever|can|can|live|without"}
    
    {the_custom_fields_from_csv_import2}
    
    {/exp:channel:entries}

    Not that I am advocating using embeds, but it’s one quick and simple example of how you might achieve this.  You could certainly use the query module to loop through both channels and pull out the custom fields from the two channels with the custom field IDs matching and display them in the template, which would be a more elegant and likely considerably more resource efficient way to achieve what I outlined here.

    Hope that helps.

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

ExpressionEngine News!

#eecms, #events, #releases