A custom reports solution (for now)

I've often wished I could customize Zotero's "generate report" function. It's great for sharing notes and associated references, but three things bug me:
1. I don't want all those fields.
2. I want to alphabetize the results by author, not title.
3. I don't like having to include a separate stylesheet when I email the report.

Apparently, the ability to customize reports is coming, but it isn't here yet.

So, I've applied my rudimentary PHP skills to hack a holdover solution: a script that takes a report's html source, gives you some options for fields you like to exclude, and then spits back out the customized report. You can also choose whether to sort by title or author, and the report's stylesheet inserted as inline CSS, so the file stands by itself.

You can find this contraption at http://jasonpriem.com/projects/report_cleaner.php ; you can run it off my server or download the source code and run it on your own. Feel free to hack it up; I put it together quickly, and I'm sure it can be improved upon.

Happy Researching!
  • I get a 404 there...
  • I get a 404 there...
    (Semi-colon was being included in the URL. Should work now.)

    Jason: Nice work on this. A couple notes:

    1) Report sorting is rather buggy in Zotero at the moment, but you can actually sort by creator in Zotero by sorting the items list in reverse alphabetical order on the Creator column and then generating the report from the context menu of the collection. (Alternatively, you can just append ?sort=firstCreator to the end of the report URL.)

    2) The reports are XHTML, which has the benefit of being valid XML. So for a tool like this, it's probably cleaner, less error-prone, and more forward-compatible to use PHP's XML functions rather than treating everything as a string and doing lots of regexes. Doesn't matter for this, of course, but something to keep in mind.
  • edited May 17, 2008
    1. Thanks for the tip on sorting; works like a charm, although the first way (reverse alpha by creator) only works if you want a report from a whole collection, as opposed to a group of selected items. The append-to-url method works great regardless.

    2. Yes, I considered going that route, but I just started doing PHP, and I don't know much about its XML functions; that's why I went the admittedly uglier regex method. I figure by the time the format of the reports changes enough to break the regexen, this thing won't be needed. But your comment makes me think maybe I'll redo it the Right Way now, as an excuse to learn more about parsing XML with PHP.

    Thanks for you comments, and keep up the awesome work. I seriously want to marry Zotero, and then name all our first ten children after it. Best. App. Ever.
  • edited June 19, 2010
    I'm reviving this thread because the website containing this script for customizing reports seems to be gone, and I haven't been able to figure out if it's gone elsewhere, or is just no longer available. Is anybody out there successfully using a customizable reports solution? I understand that there are plans to add this as a future feature to Zotero, but the last discussions I find about that date to 2008. As the original poster offers, I'd like to be able to delete certain fields from my reports. Thanks for any info or advice!
  • Maybe Dan still has the code-- Jason said he was happy for people to run it on their own machines. If anyone has a copy of the script, I'd be willing to host it on my own server for the convenience of the community, at least until Jason's site is back up and running.
  • That's great of you to offer, ajlyon -- I hope Dan or someone else has it!
  • Jason - I just tried your contraption. Great work, thanks so much for sharing this!
  • I'm searching for a possibility to output the desired Zotero Fields to a plain text file.
Sign In or Register to comment.