Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
dev:client_coding:javascript_api [2020/10/17 20:58] – [Batch Editing] dstillman | dev:client_coding:javascript_api [2020/10/17 21:05] – [Batch Editing] dstillman | ||
---|---|---|---|
Line 356: | Line 356: | ||
Before proceeding, back up your [[: | Before proceeding, back up your [[: | ||
+ | |||
+ | All examples operate on the currently selected library. | ||
==== Example: Item Field Changes ==== | ==== Example: Item Field Changes ==== | ||
Line 367: | Line 369: | ||
var fieldID = Zotero.ItemFields.getID(fieldName); | var fieldID = Zotero.ItemFields.getID(fieldName); | ||
var s = new Zotero.Search(); | var s = new Zotero.Search(); | ||
- | s.libraryID = Zotero.Libraries.userLibraryID; | + | s.libraryID = ZoteroPane.getSelectedLibraryID(); |
s.addCondition(fieldName, | s.addCondition(fieldName, | ||
var ids = await s.search(); | var ids = await s.search(); | ||
Line 397: | Line 399: | ||
var s = new Zotero.Search(); | var s = new Zotero.Search(); | ||
- | s.libraryID = Zotero.Libraries.userLibraryID; | + | s.libraryID = ZoteroPane.getSelectedLibraryID(); |
s.addCondition(' | s.addCondition(' | ||
var ids = await s.search(); | var ids = await s.search(); | ||
Line 422: | Line 424: | ||
return ids.length + " item(s) updated";</ | return ids.length + " item(s) updated";</ | ||
- | ==== Example: Convert | + | ==== Example: Convert |
+ | |||
+ | Note that this will change all instances of the tag in the library. | ||
Replace " | Replace " |