[Koha] Bad 008 fields - how to find them

Caroline Cyr-La-Rose caroline.cyr-la-rose at inlibro.com
Wed Apr 15 06:29:44 NZST 2020


Hi Elaine,

It is possible to query MARC control fields in reports. I have done it 
in the past to find badly coded records.

The command to query MARC control fields is a bit tricky, but once you 
understand it, it's easy to adapt to your needs.

For example, the query is to show the publication date is

SELECT
     biblionumber,
     SUBSTRING(EXTRACTVALUE(metadata, '//controlfield[@tag="008"]'),8,4) 
AS "Publication date"
FROM biblio_metadata

- SUBSTRING means you're getting just a part of the string of characters 
that is in 008, specifically, we start at the 8th character and we get 4 
characters. This is tricky to remember because it's not the same as the 
positions we're used to. The publication date is usually 008/07-10. But 
here, you have to add 1, so it's 8-11. (It has to do with starting to 
count at 0 or at 1; positions start at 0 but character count starts at 1).

- EXTRACTVALUE is used to search for specific MARC fields, in this case, 
we will look in the metadata field for the 008 MARC field

So you can play with this query keeping in mind that you have to add 1 
to the 008 position.

SUBSTRING(EXTRACTVALUE(metadata, '//controlfield[@tag="008"]'),16,3) for 
publication place (008/15-17)

SUBSTRING(EXTRACTVALUE(metadata, '//controlfield[@tag="008"]'),36,3) for 
language (008/35-37)

etc.

Reference: 
https://wiki.koha-community.org/wiki/SQL_Reports_Library#Query_MARC

I hope this helps!

Caroline

On 20-04-14 13 h 58, Elaine Bradtke wrote:
> An unknown number of biblios in our catalogue have bad 008 fields.  I'd
> like to be able to fix them, but how do I find  them?
> Two things I've noticed about the bad 008s, some lack a date, some have
> invalid codes in various positions.
> I'd  like to produce a list of biblionumbers of records that are missing
> dates, or have invalid codes.  Or possibly two lists one for dates, one for
> invalid codes.  Is it possible to do this with a report?  It's beyond my
> minimal skills in that area.
>
> Elaine Bradtke
> VWML
> English Folk Dance and Song Society | http://www.efdss.org
> Cecil Sharp House, 2 Regent's Park Road, London NW1 7AY
> Tel    +44 (0) 20 7485 2206 (This number is for the English Folk Dance and
> Song Society in London, England. If you wish to phone me personally, send
> an e-mail first. I work off site)
> --------------------------------------------------------------------------
> Registered Company No. 297142
> Charity Registered in England and Wales No. 305999
> _______________________________________________
>
> Koha mailing list  http://koha-community.org
> Koha at lists.katipo.co.nz
> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha

-- 
Caroline Cyr La Rose, M.S.I.
Bibliothécaire | Responsable de produit

Tél. : 1-833-465-4276, poste 221
Caroline.Cyr-La-Rose at inLibro.com <mailto:caroline.cyr-la-rose at inLibro.com>

INLiBRO | Spécialistes en technologies documentaires | www.inLibro.com 
<http://www.inLibro.com>


More information about the Koha mailing list