Bug 26531 - "add subfield" macro for Advanced Catalog Editor
Summary: "add subfield" macro for Advanced Catalog Editor
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Documentation (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-24 15:47 UTC by Jason Vasché (RRPL)
Modified: 2023-12-10 09:09 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Vasché (RRPL) 2020-09-24 15:47:23 UTC
Like the summary says: It would be great to be able to set up a macro in the Advanced Catalog Editor that would allow one to add/insert a new subfield to an existing MARC field, ex. add 245$h[GMD].
Comment 1 Andrew Fuerste-Henry 2020-09-24 16:33:25 UTC
Do your macro would, say, create an empty $a in whatever field your cursor was when you hit the macro?
Comment 2 Jason Vasché (RRPL) 2020-09-24 16:42:29 UTC
(In reply to Andrew Fuerste-Henry from comment #1)
> Do your macro would, say, create an empty $a in whatever field your cursor
> was when you hit the macro?

Yes, or if there was specific text in the subfield it would include that. Maybe something like "add 245=$h[book on CD]"
Comment 3 Andrew Fuerste-Henry 2020-09-24 17:17:30 UTC
Your example makes it look like you specifically want to add a 245$h with the value "GMD," which is doable now.
I can see some utility in being able to add the indicated subfield and value to whatever field your cursor is in.
Comment 4 Barbara Johnson 2020-09-24 20:53:11 UTC
I tried out several versions of a subfield macro but they all created a second 245 tag instead of inserting the subfield into the existing 245 tag which is what we would want. I tried it with and without indicators. Maybe this isn't the correct macro format?

Macro
new 245=‡h[DVD videorecording]
indicators=10

Output
245 1 0 ‡aJack and Jill /‡ca novel by James Patterson.
245 1 0 ‡h[DVD videorecording]

I think we would use it primarily for a 245|h but could also see using it for a 264|b or 300|b.  I think it would be a great addition.
Comment 5 Phil Ringnalda 2021-03-12 05:29:57 UTC
The keyword "new" does exactly that: adds a new one of whatever you specify, whether or not one already exists.

The syntax for subfields is "245h", so if you want to change the value of an existing GMD or add a new one if there isn't one currently there, that would be "245h=[videorecording]". If (as you probably don't since 245$h is nonrepeatable) you want to add your subfield even if there is already one with the same subfield code there, rather than changing the value of the existing one, that would be "new 245h=[videorecording]".

Both ways, you'll be adding the subfield at the end of the field, which you don't want. Since one of the reasons GMD has been replaced by a fistful of 300s is its annoying variable position either between a and b or between a and c or sometimes between n or p and c, or between n or p and b, and the resulting punctuation troubles, you would need at least two macros, one named something like "GMD no subtitle" that does "new 245h after a=[videorecording] /" and one named something like "GMD with subtitle" that does "new 245h after a=[videorecording] :". What a macro can't help you with is getting rid of the existing : or / that's currently at the end of subfield a.

As for things with n and p... I'd just do them manually.

So, is this actually a Documentation bug, because the feature already exists but isn't documented, or is there something else missing from the macro language?