<div dir="ltr">On 4 July 2017 at 16:48, Patrick Hochstenbach <span dir="ltr"><<a href="mailto:Patrick.Hochstenbach@ugent.be" target="_blank">Patrick.Hochstenbach@ugent.be</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><br>
In Catmandu::MARC 1.16 you’ll have the `marc_copy` and `marc_paste` fix available: </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
# Copy the content of the 100 field to a temporary variable<br>
marc_copy(245,tmp)<br></blockquote><div><br></div><div>Thanks a lot - it really helps! :)</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"># Change the tag of the first (and only probably) copied field to ‘400'<br>
set_field(tmp.0.tag,400)<br></blockquote><div><br></div><div>Note: this command sets the tag value to a numeric 400 rather than '400' - but that does not prevent from exporting correct data to MARC.  </div><div><br></div><div><div><font face="monospace, monospace">      [</font></div><div><font face="monospace, monospace">         400,</font></div><div><font face="monospace, monospace">         "1",</font></div><div><font face="monospace, monospace">         " ",</font></div><div><font face="monospace, monospace">         "a",</font></div><div><font face="monospace, monospace">         "Eglītis, Anšlavs,",</font></div><div><font face="monospace, monospace">         "d",</font></div><div><font face="monospace, monospace">         "1906-1993."</font></div><div><font face="monospace, monospace">      ],</font></div></div><div><br></div><div>Cheers,</div><div>Uldis</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div class="gmail-HOEnZb"><div class="gmail-h5">> On 3 Jul 2017, at 18:49, Uldis Bojars <<a href="mailto:captsolo@gmail.com">captsolo@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> On 1 July 2017 at 13:58, Patrick Hochstenbach <<a href="mailto:Patrick.Hochstenbach@ugent.be">Patrick.Hochstenbach@ugent.be</a><wbr>> wrote:<br>
><br>
> >> 1) Is it possible to also "copy" indicator values (from 100 field)? How would you do this?<br>
> >> 2) Is it possible to make a copy of a MARC field (within the record)?<br>
><br>
> With Fix you can do anything you want with JSON. A MARC record is just a 'record' key in a JSON document which contains an ARRAY of ARRAY values. All the fixes copy_field, move_field, etc etc can operate on each type of JSON document. A copy of a MARC field could be implemented with something like:<br>
><br>
> # Copy the 100 field to 400<br>
> do list(path:record, var:c)<br>
>   if all_match(c.0,100)<br>
>    copy_field(c,copy.$append)<br>
>    replace_all(copy.$end.0,100,<wbr>400)<br>
>   end<br>
> end<br>
><br>
> move_field(copy.*,record.$<wbr>append)<br>
> remove_field(copy)<br>
><br>
> This does not quite work - the 100 field gets duplicated (added to the end of the record) but its type is never changed from 100 to 400.<br>
><br>
> Any idea how to fix it? - I realise that everything that is necessary can be done using ARRAY operations but I don't yet know how to correctly write them.<br>
><br>
> Also: how would you read the value of the 1st indicator of a certain MARC field?<br>
>    - [in this case] it is OK to assume that the field appears in the record just once<br>
><br>
> Thanks,<br>
> Uldis<br>
<br>
</div></div></blockquote></div></div></div>