I need to import data from a MARC 21 file into the CCK fields. I use module MARC 6.x-2.0-beta3. I choose MARC file and necessary CCK fields in module settings. But after import the fields are empty.

For example, there is a line in marcbib.module.

$bib->loc_code = marc_clean_field(marc_value($marc, '852|a'));

As I understand, value "852|a" is a line number in MARC file, from which module gets data to import into CCK field. This line is empty in my file. I changed the value 852|a on the right line number, but it did not give results. Is this correct idea? Where is mistake? What should I do?

Thank you

CommentFileSizeAuthor
#6 Files.zip7.22 KBJolly.Wimp

Comments

aaustin’s picture

Did you go to admin/build/marc and "map" MARC fields to your CCK fields?

Sorry for the delay in responding.

Jolly.Wimp’s picture

Yes, I did. I tried, but it didn't help.

benjamin.pauley’s picture

One thing I missed the first time I tried to import:

On the Import tab, under "Options," make sure the radio button beside the content type that you want to create is highlighted, and (for good measure) click the box beside "Process Records Immediately."

Apologies if you did that already--as I say, it was something I missed the first time, which led to a failed import. (Granted, that was with MARC8 records...)

Jolly.Wimp’s picture

I've done all as you say, but without any result.

I think, that problem is in another MARC format. Module does not work correctly with MARC 21, but I don't know what I should do to fix this.

aaustin’s picture

Can you attach a small file of your records and I will test them on my site.

Jolly.Wimp’s picture

StatusFileSize
new7.22 KB

For example, you can test these files. Probably, there are some problems with encodings. If you can find a solution, could you write general instructions of solving this problem, if possible? This is a test file format, and perhaps it will be changed.

Thank you for help

aaustin’s picture

You are right, it does appear to be an issue with encodings. If I change my marc table to be latin1_general_ci encoded, the records will import - but with all ?'s for the non-latin characters.

I am afraid I need to do some research on php, mysql and encoding issues.

aaustin’s picture

I think I have it figured out. Apparently Drupal supports unicode by default so it seemed to just be an issue with the php file_get_contents() function.

So if you are not having any problems with unicode elsewhere on your site, try this:

Grab a copy of the marc.import.inc file from the cvs repository and replace your existing file.

http://drupalcode.org/viewvc/drupal/contributions/modules/marc/

Now try uploading the files. It worked for me but I am curious if it works for everyone.

I have a couple of more bugs to address, then I will put out another release of the module.

- And thanks for the files, they were extremely helpful.