[librecat-dev] sorting MARC fields

Uldis Bojars captsolo at gmail.com
Thu Jul 13 10:25:46 CEST 2017


Hi,

How do you sort record's MARC fields using the Fix language?

Since I am adding new fields they are now in a "random" order. I would like
to sort them in the order similar to what they were originally in ("FMT",
"LDR" and then the numeric fields in the increasing order).

---

Also, is there a fix similar to retain() but for MARC fields?

Currently I am filtering MARC fields (based on a whitelist) like this:

# Keep only the fields that are needed

set_array(ok_fields, FMT, LDR,
    008, 040, 041, 075, 100,
    240, 245, 246, 260,
    377, 380, 388, 400, 490,
    600, 630, 650, 670, 677,
    700, 720, 908, 910)

do marc_each()

    copy_field(record.0.0, fld_type)

    unless in(fld_type, ok_fields)
        remove_field(record)
    end

    remove_field(fld_type)                  # is this needed?

end

remove_field(ok_fields)

Thanks,
Uldis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uni-bielefeld.de/mailman2/unibi/public/librecat-dev/attachments/20170713/c054fd9e/attachment.html>


More information about the librecat-dev mailing list