"Find and Replace" for Fields

I am looking to replace every "x" in a particular field with "y" in a manner like Word's "Find and Replace" function. For example, if I realize that many of the items in my library have in the publisher field "Chicago Univ. Press" but it should be "Chicago University Press", can I fix all of these at once, without doing them one at a time?

Thanks.
  • Batch editing is planned, but for now you can do it via scripting:

    https://www.zotero.org/support/dev/client_coding/javascript_api#batch_editing
  • edited August 20, 2020
    Please excuse my ignorance / naïveté:

    1) Do the changes take place locally only after syncing to API changes online?

    2) Does the script allow IF volume field is empty then fill the volume field with "ePub" without the quotes?

    3) Does the script have the power/flexibility to search/replace IF volume AND issue fields are both empty THEN REPLACE volume, issue and whatever is in the pages field with "ePub".

    The examples in the support document are more straightforward than my needs.
  • @DWL-SDCA: This is the local API — it doesn't have anything to do with the web API. That's why the instructions say to disable syncing, in case something goes wrong and you need to restore from a local backup.

    No to the other questions, as the script is written now.
  • Hi everyone !

    I search to make something like @tmoschera but little more difficult.

    Example : I have many items with date like DL 20XX as :
    item1 : date = DL 2001
    item2 : date = DL 2018
    item3 : date = DL 2005
    ...

    I want to suppress 'DL' string to have someting like :
    item1 : date = 2001
    item2 : date = 2018
    item3 : date = 2005
    ...

    The code on the page https://www.zotero.org/support/dev/client_coding/javascript_api#batch_editing doesn't work in this case because it replace all the field.

    There exists a js string replace method which is explained on the page https://www.techonthenet.com/js/string_replace.php for example but I don't know how to use it in Zotero.

    Someone could help me please ?
    Thanks in advance.
  • @aymeric37: While that'd be easy to script for someone familiar with JavaScript (technical note: you'd use the beginsWith search condition operator to find dates beginning with "DL "), if you don't know JavaScript, I'd recommend just running the script 20 times with different old and new values. Shouldn't take more than a few minutes.
Sign In or Register to comment.