<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">Carsten Klee and I have been working on two new Fixes the last 2 days that could make copying and pasting MARC fields a bit easier than processing raw data.<br>
In Catmandu::MARC 1.16 you’ll have the `marc_copy` and `marc_paste` fix available:<br></blockquote><div><br></div><div>Can `marc_copy` and `marc_paste` help simplify this task? :</div><div style="font-size:12.800000190734863px"><br></div><div style="font-size:12.800000190734863px">1) form new MARC fields ("400") that consist of some subfields (in this order: $a $q $b $c $d) of an existing field ("100") ...</div><div style="font-size:12.800000190734863px"><br></div><div><span style="font-size:12.800000190734863px">2) ... with "." 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, [...]).</span></div><div><span style="font-size:12.800000190734863px"><br></span></div><div><span style="font-size:12.800000190734863px">3) preserve the indicators of the original "100" field.</span></div><div><br></div><div>It is not a straightforward match of `marc_copy` because of the requirements (1) and (2).<br></div><div><br></div><div>I currently solve it as Patrick suggested before `marc_copy` was introduced but this solution does not preserve indicators:</div><div><br></div><div><div>marc_map("100a", "f100a")</div><div>marc_map("100q", "f100q")</div><div>marc_map("100b", "f100b")</div><div>marc_map("100c", "f100c")</div><div>marc_map("100d", "f100d")</div><div><br></div><div>if marc_match(100aqbcd,"\.$")</div><div>  set_field(do_nothing, 'true')</div><div>end</div></div><div><br></div><div><div>marc_add(400</div><div>            ,a ,$.f100a</div><div>            ,q ,$.f100q</div><div>            ,b ,$.f100b</div><div>            ,c ,$.f100c</div><div>            ,d ,$.f100d)</div></div><div><br></div><div><div>if exists(do_nothing)</div><div>    nothing()</div><div>else</div><div>    append(record.$last.$last,".")</div><div>end</div></div><div><br></div><div>---</div><div><br></div><div>The new fixes (copy/paste) will be useful for making copies of this "400" field (we may need multiple "400" fields each with additional subfields added) but the issue with not preserving indicators remains.</div><div><br></div><div>Uldis</div></div></div></div>