[Koha] Fwd: Re: Barcode info and maybe SQL/MARCXML help needed

Doug Dearden dearden at sarsf.org
Wed Sep 19 03:04:07 NZST 2012


Hi all,

No issues here, just following up in case someone is looking at this thread in the future.

I updated the database using the sql statement below, and it deleted most of the 852 datafields.  I thought all was well but a week or so later found a record that still had some 852 datafields in it.  Upon investigation I found a number of records - around 400, and all of them had multiple 852 datafields - at least two per record.  I did some experimentation and the sql statement below only works on those records where there is a single 852 datafield.  I tried some variations and found that if I ran this one it would remove the first 852 datafield:
 
update biblioitems set marcxml = UpdateXML(marcxml, 
'//datafield[@tag="852"][1]', '');

I did a backup, ran the sql statement above several times until it returned 0 records changed (17 in fact, as I had one record with 16 852 datafields).  Each time it ran it stripped off the leading 852 datafield.  I then ran this one to check for any leftovers:

SELECT 
   ExtractValue (marcxml ,'//datafield[@tag="852"]/*')
FROM biblioitems
WHERE marcxml RLIKE '<datafield tag="852"';

It returned zero results.

Ran touch_all_biblios.pl 
Zebra indexes rebuilt that night as part of our regular cron job.

All looks good.

- Doug  

-----Original Message-----
From: Galen Charlton [mailto:gmc at esilibrary.com] 
Sent: Tuesday, August 28, 2012 3:42 PM
To: Doug Dearden
Subject: Re: [Koha] Fwd: Re: Barcode info and maybe SQL/MARCXML help needed

Hi,

No, whitespace between datafield elements is irrelevant as far as Koha's 
parsing of the MARCXML records is concerned.

Regards,

Galen

On 08/28/2012 04:27 PM, Doug Dearden wrote:
> Hi Galen,
>
> I ran the sql command against my test DB to delete the 852 tag limiting it to one record.  It takes out the 852 datafield but leaves behind some blank space - example below.  Is this going to matter?  - Thanks, Doug
>
>    <datafield tag="700" ind1=" " ind2=" ">
>      <subfield code="a">Hymes, Dell, editor.</subfield>
>    </datafield>
>
>    <datafield tag="942" ind1=" " ind2=" ">
>      <subfield code="c">BK</subfield>
>    </datafield>
>
> -----Original Message-----
> From: koha-bounces at lists.katipo.co.nz [mailto:koha-bounces at lists.katipo.co.nz] On Behalf Of Galen Charlton
> Sent: Tuesday, August 28, 2012 12:59 PM
> To: koha at lists.katipo.co.nz
> Subject: Re: [Koha] Fwd: Re: Barcode info and maybe SQL/MARCXML help needed
>
> Hi,
>
> On 08/28/2012 02:56 PM, Galen Charlton wrote:
>> Unless you had changed your MARC frameworks to use the 852 field for
>> item data rather than the 952, if the 852s are from your previous
>> system, I'd suggest that you actually *delete* them.  A bib export from
>> Koha will include the item data in 952 fields if you need them for
>> record interchange or union catalog purposes, and getting rid of the
>> legacy 852s avoids the risk of confusing staff about the state of an
>> item record.
>
> And you can delete the 852 fields in two steps (or three, counting the
> backup you should make first :) ).  First, run the following SQL update:
>
> update biblioitems set marcxml = UpdateXML(marcxml,
> '//datafield[@tag="852"]', '');
>
> Then run touch_all_biblios.pl, which will (in addition to signalling
> that the bibs should be reindexed) synchronize biblioitems.marc with
> biblioitems.marcxml.
>
> Regards,
>
> Galen
>


-- 
Galen Charlton
Director of Support and Implementation
Equinox Software, Inc. / The Open Source Experts
email:  gmc at esilibrary.com
direct: +1 770-709-5581
cell:   +1 404-984-4366
skype:  gmcharlt
web:    http://www.esilibrary.com/
Supporting Koha and Evergreen: http://koha-community.org & 
http://evergreen-ils.org




More information about the Koha mailing list