Is there a way to fill in the short title automatically?

edited January 9, 2020
I have a quite large collection of some 700 titles, which I want to integrate into another database. Part of this database is the field "Short title", so I have to fill this field in Zotero as well. I did not use the field before regularly and it was just filled sometimes by the picker without any apparent system.

I would like to fill this field systematically with the expression (pseudocode): "Authors Lastname Year". I could go through the entire DB by hand, but this since these data are already in the DB and could be filled in automatically. Is there something like an expression editor in Zotero, which I could use for that?
  • For that sort of code, I would suggest against using the Short Title field, which is really for short forms of the title that might appear in a citation.

    For this code, I would suggest storing it in Extra like this:
    Citation Key: LastnameYear

    If you install the Better BibTeX plugin, it will automatically generate citation keys for you, according to whichever pattern you prefer.
  • There is no expression editor or the like.
    Depending on your preferences, you can do this with the server API, e.g. using pyzotero python library (https://github.com/urschrei/pyzotero), or you can use the local javascript API
    https://www.zotero.org/support/dev/client_coding/javascript_api

    Both require some coding, though.

    It's possible this could be done using some of Zutilo's newer functions: https://github.com/willsALMANJ/Zutilo/blob/master/docs/USAGE.md#item-field-modification-functions
    but I don't think so since you want to use item data to fill that field.
  • Thanks for the answers.
    @bwiernik That is a good hint. I created the BBT-Keys for my library which would work for me. However, I have to export the library as a CSV in order to get it into my PostgreSQL database. Can I export the BBT-Key in a CSV somehow?
  • I looked more detailed into zutilo as well and I think, that this is a more elegant solution to my problem. Actually my PostgreSQL DB holds mainly geographic information and categorizations. My literature is often the source for these categorizations so I want to link my literature to the geographic information.

    But there is no need to build a second, redundant version of the complete literature DB, so all I store now in the literature-table is an id for linking the stuff within my Postgres-DB (this is generated automatically), a link (URI) generated by zutilo and a human readable short quote (Lastname Year).

    There are two questions remaining:
    1) Is there a way to generate a CSV from Zotero that holds only the Zutilo-URI and the short quote as defined above?
    2) At the moment I store the links as URI's which work quite fine. I would, however, prefer to run the hole thing locally, in case I have to work without internet. I could not figure out, how to use the local "select items link" generated by zutilo to access my local library. Is there a trick to do that?
  • @lgoldmann only "somehow". There's a translator I use for debug purposes called "BetterBibTeX JSON"; that translator will export JSON (as one might expect) which holds a.o. the BBT citekey. If you are comfortable coding, it should be pretty easy to create CSV from that.

    Another option, albeit *much* more involved, would be to export CSV as usual, read the citekey from the BBT database, and merge those. But BBTs database uses JSON under the hood, so I don't see any benefit at all from going this route.

    *Technically* you could parse the BBT bibtex and fetch enough data that way to create your CSV. I see zero benefit in doing this.

    The last two options I only list for completeness sake. Don't opt for those. I don't currently know of any other ways than these to export the citekey.
  • I see our edits crossed. Zotero RDF has enough information to recreate the links/short quote. BBT JSON will have the info too.
  • @lgoldmann Regarding your two remaining questions:

    1) You could perhaps look into adapting Emiliano's Zotero SeekTable CSV export translator. It exports BBT citation keys. An example translator for zotero://select links is https://gist.github.com/nschneid/3134386 . Zotero's documentation on export translators is here.

    2) Getting zotero:// links to work will depend on your operating system. Usually the first thing to try is to e.g. insert a zotero://select link into your web browser's address bar. BTW, for local links, you could also use zotero://select/items/@[citekey] links using BBT's citekey.
Sign In or Register to comment.