I have 4 columns in a CSV which need to all combine as multiple values into a term reference field.

I would very much like to avoid having to modify the CSV myself before upload, as this will be a regular activity by the client, and so the less I need to ask of them the better.

I currently have it set up as per the attached screenshot, which does seem to happily create the terms present in each column, but the final result is that only the last mapping for that field is saved, so they seem to be overwriting each other rather than grouping.

From other issues I gather this is a hot topic so apologies if this is a duplicate issue however I wasn't able to find the appropriate issue to subscribe to, even though I'm certain I've seen it before!

Thanks!

CommentFileSizeAuthor
Screen shot 2011-09-07 at 4.42.28 PM.png54.85 KBcarn1x
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Pocketpain’s picture

sub

Agileware’s picture

carn1x’s picture

Unfortunately Feeds Tamper doesn't seem to provide any method of merging multiple columns, only splitting a single column. But I hope/suspect Feeds Tamper will grow to incorporate such behaviour :)

Agileware’s picture

Feeds Tamper has plugins, Impode and Explode which does exactly that.

We are using it to import a CSV file containing multi-value entries separated by pipe eg. "ABC | DEF | GHI", "JKL|MNO|PQR" etc.

Agileware’s picture

@carn1x sorry, I stand corrected. I had missed the key part which was "multiple columns". So Feeds Tamper won't do this for you as it only acts on individual columns.

Having said that, if you configure Feeds to import each column into the same node field, does this not work already? I am pretty confident that Feeds will just append the values, I faintly recall having done this to import a XML feed into a multivalue field.

carn1x’s picture

@Agileware Tried this before, mapping multiple columns to the same field. It ended up simply setting the field to the last column that was mapped. Maybe it depends on the widget used, as I only tried this will Term Reference Autocomplete?

johnv’s picture

MegaChriz’s picture

Component: Feeds Import » Code
Issue summary: View changes
Status: Active » Fixed

You can do this easily with using the Feeds Tamper plugins "Rewrite" and "Explode" in combination.

  1. Of the columns which should go to the same target, map each except one to "Temporary target 1". Map one to the desired target. For example, if you have four columns which should map to "field_tags", map three to "Temporary target 1" and one to "field_tags".
  2. On "field_tags" add a "Rewrite" plugin. Use this to glue the values together, separated by a character of your choice (for example, a pipe character: |). For example, if you have four columns called "term_1", "term_2", "term_3" and "term_4", configure the rewrite like this:
    [term_1]|[term_2]|[term_3]|[term_4]
    
  3. Add an "Explode" plugin to separate the terms. Set "String separator" to the character you chose to concatenate the fields in step 2 (for example, a pipe character: |).

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.