<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<div style="color: rgb(33, 33, 33);">
<div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote"><br>
<div><span style="font-size: 12pt;">>> 1) Is it possible to also "copy" indicator values (from 100 field)? How would you do this?</span><br>
</div>
<div><span style="font-size: 12pt;">>> 2) Is it possible to make a copy of a MARC field (within the record)?</span><br>
</div>
<div><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>
</div>
<div><br>
</div>
<div>
<div># Copy the 100 field to 400</div>
<div>do list(path:record, var:c)</div>
<div>  if all_match(c.0,100)</div>
<div>   copy_field(c,copy.$append)</div>
<div>   replace_all(copy.$end.0,100,400)</div>
<div>  end</div>
<div>end</div>
<div><br>
</div>
<div>move_field(copy.*,record.$append)<br>
</div>
<div>remove_field(copy)<br>
</div>
<br>
</div>
<div>This is ARRAY processing without knowing this ARRAY is MARC. What Catmandu::MARC does is hiding a lot of this array processing and provide a much simpler MARCPath and MARCSpec syntax. Alas, the marc_copy_field is not something implemented yet in this easier
 syntax, but <span style="font-size: 12pt;">I've made a ticket for </span><span style="font-size: 12pt;">that: </span><a href="https://github.com/LibreCat/Catmandu-MARC/issues/76" style="font-size: 12pt;">https://github.com/LibreCat/Catmandu-MARC/issues/76</a></div>
<div><br>
</div>
<div>​<span style="font-size: 12pt;">3) marc_add</span><br>
</div>
<div><span style="font-size: 12pt;"><br>
</span></div>
<div><span style="font-size: 12pt;">The marc_add could be used to add data to a new MARC record ..but I see this option doesn't work anymore. Also for this I created a ticket: <a href="https://github.com/LibreCat/Catmandu-MARC/issues/77">https://github.com/LibreCat/Catmandu-MARC/issues/77</a></span></div>
<div><br>
<br>
</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>
<div class="gmail-m_-3313603927294503163gmail-m_-6321139617529349181m_6669267379397702592h5">
> On 28 Jun 2017, at 18:41, Uldis Bojars <<a href="mailto:captsolo@gmail.com" target="_blank">captsolo@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> Could you suggest how to do this in Catmandu:<br>
><br>
> I need to form a new MARC field ("400") that consist of some subfields (in this order: $a $q $b $c $d) of an existing field ("100"). That much is not difficult, but there's another condition:<br>
><br>
> "." must be added to the last subfield that exists (e.g. if $d exists append "." to it unless it already ends with ".", otherwise do the same with $c, [...]) .<br>
><br>
> Questions:<br>
><br>
> 1) how to determine if a field (e.g. fld_100d created via marc_map) ends with "." ?<br>
><br>
> 2) is there a way to "package" some functionality and call it when needed?<br>
><br>
> In this case it would be good to create a function that appends "." to the field provided as a parameter unless it already ends with ".".<br>
><br>
> Then what is needed could be achieved like this:<br>
><br>
> if exists("fld_100d"):<br>
>    my_function("fld_100d")<br>
> elsif exists("fld_100c"):<br>
>    my_function("fld_100c")<br>
> elsif [...]<br>
>    [...]<br>
> end<br>
><br>
> P.S. Perhaps there is a more idiomatic way how to do this in Catmandu?<br>
><br>
> Thanks,<br>
> Uldis<br>
><br>
</div>
</div>
> ______________________________<wbr>_________________<br>
> librecat-dev mailing list<br>
> - send list mails to <a href="mailto:librecat-dev@lists.uni-bielefeld.de" target="_blank">
librecat-dev@lists.uni-bielefe<wbr>ld.de</a><br>
> - to unsubscribe or change options, visit <a href="https://lists.uni-bielefeld.de/mailman2/cgi/unibi/listinfo/librecat-dev" rel="noreferrer" target="_blank">
https://lists.uni-bielefeld.de<wbr>/mailman2/cgi/unibi/listinfo/l<wbr>ibrecat-dev</a><br>
> - project website: <a href="http://librecat.org/" rel="noreferrer" target="_blank">
http://librecat.org/</a><br>
<br>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</body>
</html>