Migrating multiple values into a single file field in Drupal 7 with Migrate 2.2 I have a file field that can have multiple downloadable files for an image node type. These images will have several versions (psd, jpg, eps) that will be downloadable. I would like to be able to append multiple values to this field. How would I do that when they are coming from multiple source columns (i.e. eps_filename, jpg_filename, psd_filename)?

I found related documentation here: http://drupal.org/node/1012810 But that documentation is for taxonomy terms where the details of the value can simply be a string with a separator. For this I am using MigrateFileFieldHandler::arguments(), so I can't just give it a separator.

Further what I would like to do is also be able to come back later and append more files to the migrated nodes. This is because the larger files will take longer to get on the server, so their smaller counterparts (jpg, png, etc) will be loaded first and then adding the eps files later. Now I already figured out how to update the previously migrated nodes using systemOfRecord. But I am not sure how to append to a multi-value field.

I am using Drupal 7 and the Migrate module version 2.2. Here is some sample code I am using for migrating the data initially into the file field.

$jpg_arguments = MigrateFileFieldHandler::arguments(NULL,
  'file_link', FILE_EXISTS_RENAME, 'en', array('source_field' =&gt; 'jpg_name'),
  array('source_field' =&gt; 'jpg_filename'), array('source_field' =&gt; 'jpg_filename'));

$this-&gt;addFieldMapping('field_file', 'jpg_uri')
     -&gt;arguments($jpg_arguments);


I suspect the trick is using the prepareRow() function. But so far I have not been able to get that to execute yet.

Any ideas? I really appreciate any help.

Thanks!
I think what you need is prepareRow. Here is code from the migrate baseball example where multiple fields are merged into a single array field.

 function prepareRow($row) {
    // Collect all the batters into one multi-value field.
    for ($i=1; $i &lt;= 9; $i++ ) {
      $key = "visiting_batter_$i";
      $visiting_batters[] = $row-&gt;$key;
      $key = "home_batter_$i";
      $home_batters[] = $row-&gt;$key;
    }
    $row-&gt;visiting_batters = implode(',', $visiting_batters);
    $row-&gt;home_batters = implode(',', $home_batters);
    $row-&gt;title = "$row-&gt;home_team vs. $row-&gt;visiting_team. " . gmdate('M d, Y', strtotime($row-&gt;start_date));
  }


(from the file migrate_example_baseball.migrate.inc)

However I have been having mixed results with prepareRow in my own code, so while this looks straight forward I can't guarantee that it will work.