[Koha] Reports by Indicator

Fridolin SOMERS fridolin.somers at biblibre.com
Sat Jan 8 13:35:36 NZDT 2022


Hi, Happy New Year 2022.

 >      Here's a sample problem: finding subject headings whose ind 2 = "4".
 >      WHERE ExtractValue(metadata, 
'//datafield[@tag="650"]/@ind2="2"') = "4"

I'd say it should be :
WHERE ExtractValue(metadata, 
'count(//datafield[@tag="650"][@ind2="4"])') > 0

Do not use //datafield[@tag="650"]/@ind2 because if there are several 
650 values will be contatenated so not equal to 4.

My reference is :
https://www.w3schools.com/xml/xpath_syntax.asp

Best regards,

Le 05/01/2022 à 16:35, Charles Kelley a écrit :
> Hi, all!
> 
>      Happy New Year, everyone!
> 
>      I know how to compile a report when a subfield has particular value. Is
> there a way to compile a report when ind 1 or ind 2 has a particular value?
> 
>      Here's a sample problem: finding subject headings whose ind 2 = "4".
> 
>      The SQL SELECT statement might look something like
> 
> SELECT
>          biblioitems.biblionumber AS 'Bib. Record No.',
> ExtractValue(metadata, '//datafield[@tag="245"]/subfield[@code="a"]') AS
> 'Main Title', ExtractValue(metadata,'//datafield[@tag="650"]/subfield[@ind2
> ="1"]') AS 'Topical Subject'
>      FROM biblioitems
>      JOIN biblio_metadata ON (biblioitems.biblionumber =
> biblio_metadata.biblionumber)
>      WHERE ExtractValue(metadata, '//datafield[@tag="650"]/@ind2="2"') = "4"
> 
>      I've looked in the Koha wiki, but I have not successfully found hints,
> instructions, sample reports, etc.
> 
>      Can anyone suggest an alternative? Maybe MarcEdit will be easier than
> SQL.
> 
>      Many thanks!
> 

-- 
Fridolin SOMERS <fridolin.somers at biblibre.com>
Software and system maintainer 🦄
BibLibre, France


More information about the Koha mailing list