[librecat-dev] Doing math calculations inside a Catmandu fix
Patrick Hochstenbach
Patrick.Hochstenbach at UGent.be
Fri Oct 27 14:49:15 CEST 2023
Dear Martina,
Perl fixes have a very limited support for calculations. But with the perlcode fix you can do any kind of calculation possible in Perl (and that is a lot).
E.g. here is a way to add 1 to the year field in the MARC 008/07-10 tag:
# copy 008 date to the 'date' field
marc_map(008/07-10,date)
# do some calculation
perlcode(myscript.pl)
# return the 'date' value back into the date field
marc_set(008/07-10,$.date)
where myscript.pl is a file that contains:
sub {
my $data = shift;
$data->{date} = $data->{date} + 1;
return $data;
}
BR
Patrick
________________________________
From: librecat-dev-bounces at lists.uni-bielefeld.de <librecat-dev-bounces at lists.uni-bielefeld.de> on behalf of Siebert, Dr. Martina <Martina.Siebert at sbb.spk-berlin.de>
Sent: 27 October 2023 14:25
To: librecat-dev at lists.uni-bielefeld.de <librecat-dev at lists.uni-bielefeld.de>
Subject: [librecat-dev] Doing math calculations inside a Catmandu fix
Dear all,
I am stuck with this problem:
I only have a date in Taiwan Republican counting in my data and need a Georgian date for PICA+.
How do I add 1911 to the value 112 to get 2023?
Best,
Martina
______________________________________________
Dr. Martina Siebert
Ostasienabteilung | CrossAsia
Staatsbibliothek zu Berlin – Preußischer Kulturbesitz
martina.siebert at sbb.spk-berlin.de<mailto:martina.siebert at sbb.spk-berlin.de>
www.staatsbibliothek-berlin.de<http://www.staatsbibliothek-berlin.de/>
Im Rahmen der E-Mail-Kommunikation werden gegebenenfalls personenbezogene Daten verarbeitet.
Unsere Hinweise zum Datenschutz finden Sie hier: http://sbb.berlin/datenschutz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uni-bielefeld.de/mailman2/unibi/public/librecat-dev/attachments/20231027/e2ecb766/attachment.html>
More information about the librecat-dev
mailing list