[librecat-dev] string operations, defining functions in Catmandu

Uldis Bojars captsolo at gmail.com
Mon Jul 3 18:49:51 CEST 2017

On 1 July 2017 at 13:58, Patrick Hochstenbach <Patrick.Hochstenbach at ugent.be
> wrote:

> >> 1) Is it possible to also "copy" indicator values (from 100 field)? How
> would you do this?
> >> 2) Is it possible to make a copy of a MARC field (within the record)?
> 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:
> # Copy the 100 field to 400
> do list(path:record, var:c)
>   if all_match(c.0,100)
>    copy_field(c,copy.$append)
>    replace_all(copy.$end.0,100,400)
>   end
> end
> move_field(copy.*,record.$append)
> remove_field(copy)

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.

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

Also: how would you read the value of the 1st indicator of a certain MARC
   - [in this case] it is OK to assume that the field appears in the record
just once

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uni-bielefeld.de/mailman2/unibi/public/librecat-dev/attachments/20170703/4e6ec9ce/attachment.html>

More information about the librecat-dev mailing list