Is there any way to convert all "report" items to "preprint" ?

Since the last Zotero update preprints now use the new preprint item type. Is there any way to convert all previously added preprints that were added as "report" items to the "preprint" item type? I have 4000+ items in my library and it would take considerable time to do it manually.

Thank you.
  • Do these report items have anything that identifies them collectively?
  • I’m not sure I understand your question; by "identifies them collectively" you mean like a tag?

    If that’s the case, I can sort my entire library by "item type" then select all the "report" items, and apply them a tag? Would that work?
  • That, or if you want to just convert all "report" items, you don't need to tag them, I could just work with that.
  • I think if you literally want to convert all reports, that's the only identifier you need. If there's only a subset you want to convert (e.g., because you also have actual reports in your library) then you'd need the identifier.
  • I want to convert all "report" items in my library to "preprint". I was only using the "report" item type because the "preprint" type wasn’t available in previous Zotero versions.
  • Go to Tools -> Developer -> Run Javascript, check "run as async function", paste the script below under Code: and click Run

    const preprint = Zotero.ItemTypes.getID('preprint')

    const search = new Zotero.Search()
    search.addCondition('itemType', 'is', 'report')
    const itemIDs = await search.search()

    if (itemIDs.length) {
    for (const item of await Zotero.Items.getAsync(itemIDs)) {
    item.setType(preprint)
    await item.saveTx()
    }
    }


    I've tested this on my end, I don't see what could go wrong, but still, you assume the risk.
  • Worked perfectly. Thank you for your help @emilianoeheyns !
Sign In or Register to comment.