<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Thanks Seb.&nbsp; I think it's probably too late on a Friday evening for
    this - I see what you're saying, but can't seem to make it work...<br>
    <br>
    I'll try again on Monday and see how I get on.<br>
    <br>
    Lizz<br>
    <br>
    <div class="moz-cite-prefix">On 17/10/2014 16:37, sf2 wrote:<br>
    </div>
    <blockquote
cite="mid:EMEW3|81bfd38adafedc46a69698b159ae5e0dq9GGid14eprints-tech-bounces|ecs.soton.ac.uk|c0a1198b296d9d4aaaf0c21e4a8b26c0@ecs.soton.ac.uk"
      type="cite">
      <p>I meant:</p>
      <p>my @creators = @{ $eprint-&gt;value( 'creators' ) || [] };</p>
      <p>foreach my $creator (@creators)</p>
      <p>...</p>
      <p>&nbsp;</p>
      <p>Seb</p>
      <p>On 17.10.2014 16:31, sf2 wrote:</p>
      <blockquote type="cite" style="padding-left:5px;
        border-left:#1010ff 2px solid; margin-left:5px"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
        <p>Hola Lizz,</p>
        <p>I would do something like:</p>
        <p>my $creators = @{ $eprint-&gt;value( 'creators' ) || [] };</p>
        <p>...</p>
        <p>push @newcreators, { name =&gt; ... , etc };</p>
        <p>...</p>
        <p>&nbsp;</p>
        <p>in your example you push an array-ref onto the array rather
          than pushing a single record/row:</p>
        <p>push @foo, [ { ... } ] vs push @foo, { ... }</p>
        <p>Seb</p>
        <p>On 17.10.2014 16:33, Lizz Jennings wrote:</p>
        <blockquote style="padding-left: 5px; border-left: #1010ff 2px
          solid; margin-left: 5px;"><!-- node type 8 --><!-- node type 8 --><!-- node type 8 -->
          <pre>Hi all,

I'm getting in a bit of a tangle.

I'd like to be able to add a function to eprint_fields_automatic for the 
creators field to generate affiliation information based on email 
addresses (where it's obvious e.g. academic institutions). I've hit a 
stumbling block immediately - I can't seem to get this to work without 
overwriting the whole thing with a single row (I've managed several 
variations on this particular theme).

This currently works to overwrite the whole list with the first creator 
and does add in or change the affiliation.

     if ( $type eq "data_collection" ) {
             my $creators = $eprint-&gt;get_value( "creators" );
         my @newcreators;
         foreach my $creator (@$creators) {
             push @newcreators, [{ name =&gt; $creator-&gt;{name}, id =&gt; 
$creator-&gt;{id}, orcid =&gt; $creator-&gt;{orcid}, affiliation =&gt; "bibble", 
contact =&gt; $creator-&gt;{contact} }];
         }
         $eprint-&gt;set_value( "creators", @newcreators );

     }

Any ideas on how to do this properly would be much appreciated.

Lizz
</pre>
        </blockquote>
        <p>&nbsp;</p>
        <div>&nbsp;</div>
        <!-- html ignored --><br>
        <pre>*** Options: <a moz-do-not-send="true" href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a>
*** Archive: <a moz-do-not-send="true" href="http://www.eprints.org/tech.php/">http://www.eprints.org/tech.php/</a>
*** EPrints community wiki: <a moz-do-not-send="true" href="http://wiki.eprints.org/">http://wiki.eprints.org/</a>
*** EPrints developers Forum: <a moz-do-not-send="true" href="http://forum.eprints.org/">http://forum.eprints.org/</a>
</pre>
      </blockquote>
      <p>&nbsp;</p>
      <div>&nbsp;</div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">*** Options: <a class="moz-txt-link-freetext" href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a>
*** Archive: <a class="moz-txt-link-freetext" href="http://www.eprints.org/tech.php/">http://www.eprints.org/tech.php/</a>
*** EPrints community wiki: <a class="moz-txt-link-freetext" href="http://wiki.eprints.org/">http://wiki.eprints.org/</a>
*** EPrints developers Forum: <a class="moz-txt-link-freetext" href="http://forum.eprints.org/">http://forum.eprints.org/</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Lizz Jennings BA MSc ACLIP MCLIP (Revalidated 2014)
Technical Data Officer
The Library 4.10, University of Bath, Bath, BA2 7AY UK
Ext. 3570 (External 01225 383570)
<a class="moz-txt-link-abbreviated" href="mailto:E.Jennings@bath.ac.uk">E.Jennings@bath.ac.uk</a></pre>
  </body>
</html>