Closed jasloe closed 5 years ago
The lookup
fix requires as first parameter a field which contains a string. This string will be matched with the CSV file in the second parameter. E.g.
# tmp will contain the record number
marc_map(001,tmp)
# the record number in tmp will be replaced with the value found in file.csv
lookup(tmp,file.csv)
In your case you need some MARC magic to create a new 008
field. This can be done like:
# Create a new field an lookup the content in a CSV file
add_field(tmp.tag,'008')
add_field(tmp.ind1,' ')
add_field(tmp.ind2,' ')
marc_map(001,tmp.content)
lookup(tmp.content,file.csv)
# Paste the new field after an existing 007 field in the record
marc_paste(tmp,at:007)
remove_field(tmp)
All this assumes that the 001
and 007
exist in every record you are going to process. The current marc_paste
lacks functionality to add the 008
at the correct place even it 007
doesn't exist in the record. I'll made a ticket for that https://github.com/LibreCat/Catmandu-MARC/issues/90
That works just fine. I don't think I've seen the .tag and .content patterns before. Is there documentation available?
A quick support request. It's been a long time since I've worked with Catmandu so bear with me.
I have a list of 008 control fields that were generated elsewhere which I'd like to incorporate into my MARC records.
The 001 control field is the key I'll use to join the 008 data to their respective records.
Given the following in test.csv:
Copy 001 to a temporary variable:
Compare that variable to a list:
Set the resulting value to the 008 field, then paste after 007:
Unfortunately, the lookup appears to not work. The script simply copies 001 to tmp, pastes to 008 and entirely ignores the lookup.
Am I missing something?