Adapting the csv translator with parsed dates
I would like to adapt the CSV.js translator to include the parsed version of the publication date, but I do not know how to retrieve the list of available field. Any help warmly appreciated !
Andreas
Andreas
https://api.zotero.org/itemFields
However, not all fields are present in all item types.
But I don't know exactly what field you are missing at the moment in the CSV translator. Maybe, you can give an example?
also has a complete list afaik.
The CSV translator provides the (publication) date as it has been entered, I can see that zotero is able to parse heterogenous formats and extract Y M D, my aim is to retrieve this structured information so that I do not have to replicate zotero's algorythm later.
(I just saw that you are the author of the csv translator, so I am getting it straight from the horse's mouth !)
Looking at the list your linked to, it seems that the parsed DMY information Zotero displays is not natively available in the field list.
Is there a piece of code I could use to include in your translator so that heterogeneous data values such as "05.02.2016", "5 february 2016", "05/02/2016" and "february 5, 2016" all get rendered as something like "05-02-2016" ?
Best regards from the Swiss Alps
Andreas
Zotero.Utilities.strToDate(item.date)
Update: Actually, strToISO is even better for this porpuse.
PY Date Date Added Date Modified Access Date
2016 05.02.2016 2016-02-05 20:48:17 2016-02-05 20:48:31
2016 Januar 1, 2016 2016-01-21 22:10:48 2016-01-21 22:10:48 2016-01-21 22:10:48
And AFAIK "Date" is just purily "item.date". If we replace the date with by "ZU.strToDate(item.date)" we should have
PY Date Date Added Date Modified Access Date
2016 2016-02-05 2016-02-05 20:48:17 2016-02-05 20:48:31
2016 2016-01-01 2016-01-21 22:10:48 2016-01-21 22:10:48 2016-01-21 22:10:48
Does this sound good? Or is there any use case to have also the not-normalized date as well?
edit: and yes, that does sound good.
My management wanted an additional argument for switching to Zotero.
I think you just gave the final word.
Thanks a lot to both of you.
I am using the csv translator to export a list of authors for specific articles (in a style close to chicago).
Around the line 160 of the js file, the value "i" uses item.creator.lengh, but it uses all creators, I only want authors. Is there a way to adapt the counter so that it only refers to "autors" ?
Any hint warmly welcome...
Best
Andreas
The CSV translator works well indeed, I am using it as a base to do something else, which requires me to count the number of authors, I was hoping to be able to do it with the item.creator.length, but this counts also the editors (although editors are filetered out later, as you mentioned), so that comparing "i" value and item.creator.lenght to flag the last author doesn't work. Would you have any suggestion ?
Best
Andreas
In the beginning of the for loop add
var count = 0;
and in the end of the for loop add
count++;
Then just output the variable j for the function call with field="creators/author".
Thanks again, without you we couldn't have solved our local problem (and I wouldn't have spent those days learning basic javascript with as much success).
Enjoy the summer.
Andreas