[Koha] MARC modification templates problem

Caroline Cyr La Rose caroline.cyr-la-rose at inlibro.com
Tue Aug 8 01:40:24 NZST 2023


Hi Eric,

This has been my experience as well. I haven't found a way to modify 
only one field when there are more that one of the same tag in the same 
record.

Are the links you are trying to change all the same domain? Or a couple 
of different domains? If so, you could match the regex on a longer part 
of the URL e.g. 
s/^https://some-online-resource.com/https://proxy.cca.edu/url?=https://some-online-resource.com

You can have many options in one modification template, so you can have 
many "copy and replace" for various resources. Or you can do it by 
batch. The latter is usually what I've done in the past: make a report 
to have the URLs matching some-online-resource.com, batch modify those. 
Then change the modification template, change the report to have the 
URLs another-online-resource.com and batch modify those records, etc.

Good luck!

Caroline

On 2023-08-04 11:31, Eric Phetteplace wrote:
> Hi collective wisdom,
>
> I'm running into a MARC modification template problem and I can't tell if
> I'm missing something or there's a bug/limitation. I know I could
> accomplish these edits with MARCEdit or a script, but I was hoping to use
> Koha's tools.
>
> I have a record with two 856 fields with links, I want to apply our proxy
> server prefix to one link but not the other. That seems to be impossible;
> Koha clobbers the second link with a copy of the first. Here's a minimal
> example.
>
> Record
> 245 _ _ ‡aExample
> 856 4 0 ‡uhttps://example.com‡yLink to proxy
> 856 4 0 ‡uhttps://www.cca.edu‡yLink to retain
>
> MARC modification
> Copy and replace 1st field(s) 856 u to field 856 u Regex ✅ s/^http/
> https://proxy.cca.edu/url?=http/
> If field 856 u matches m/https://example.com/  Regex ✅
>
> Output record
> 245    _aExample
> 856 40 _uhttps://proxy.cca.edu/url?=https://example.com
>         _yLink to proxy
> 856 40 _uhttps://proxy.cca.edu/url?=https://example.com
>         _yLink to retain
>
> This happens whether I set the modification template to use the "1st" or
> "every"  856 field. I don't understand why the second 856 is touched at
> all, since it does not meet the "if" condition, much less why instead of
> receiving its own link proxied it gets the first 856 URL proxied.
>
> Based on a few tests, it also seems like the "1st" field with respect to
> modification actions is not always the one that's visually first when I
> edit a record. I tried a set of three actions which 1) copied the first
> field to another, unused field, 2) modified it there, and then 3) copied it
> back, but Koha copied the second field instead.
>
> Best,
>
> ERIC PHETTEPLACE Systems Librarian, Libraries (he/him)
>
> ephetteplace at cca.edu
>
>
> *CCA is situated on the traditional unceded lands of the **Chochenyo and
> Ramaytush Ohlone** peoples.*
>
> Black-owned bookstores in Oakland: Ashay by the Bay
> <https://ashaybythebay.com/>, Marcus Books
> <https://www.facebook.com/marcus.books/>
>
> :(){ :|: & };:
> _______________________________________________
>
> Koha mailing listhttp://koha-community.org
> Koha at lists.katipo.co.nz
> Unsubscribe:https://lists.katipo.co.nz/mailman/listinfo/koha
-- 
Logo inLibro <https://inLibro.com> 	Caroline Cyr-La-Rose
Bibliothécaire | Responsable de produit

T 833-INLIBRO (465-4276) <tel:833-465-4276>, poste 221
C caroline.cyr-la-rose at inlibro.com

www.inLibro.com <https://inLibro.com>


More information about the Koha mailing list