A Note item.title = undefined? (URI export translator)
Hello I am adapting the "Select item" translator with success so I have the title + URI of an item. It works with every item with a link but whenever I try to do it with a note the item title shown is "undefined".
Example:
(with items with links, like articles)
1.1 Alcohol intake and pregnancy - UpToDate zotero://select/items/6_6CXJ8EYV
1.0 Substance use by pregnant women - UpToDate zotero://select/items/6_FRQCETT2
(with notes)
undefined zotero://select/items/6_JL9UALAT
Link to the original translator :
https://raw.githubusercontent.com/Zotero-ODF-Scan/zotero-odf-scan/master/attic/Zotero Select Item.js
Question:
What is the equivalent of "item.title" for a note ? if it could give me even the first 10 words of a note I think it should be fine. If it is too much work to learn how to make it work with that translator I am fine having 2 version of the same translator.
Details:
This is important for me since I use a standalone note as the main note of a topic in zotero, with many URIs like the ones above to link to the many child note each article has. It makes Zotero really useful for me. I using a workaround with excel to get the title of a note and concatenate it with the URI, but there must be an easier way,
I read as much as I could but I couldn't find a answer. I don't know how to code but I can figure stuff out, only I don't have much free time to do so.
Any advice is appreciated!
Example:
(with items with links, like articles)
1.1 Alcohol intake and pregnancy - UpToDate zotero://select/items/6_6CXJ8EYV
1.0 Substance use by pregnant women - UpToDate zotero://select/items/6_FRQCETT2
(with notes)
undefined zotero://select/items/6_JL9UALAT
Link to the original translator :
https://raw.githubusercontent.com/Zotero-ODF-Scan/zotero-odf-scan/master/attic/Zotero Select Item.js
Question:
What is the equivalent of "item.title" for a note ? if it could give me even the first 10 words of a note I think it should be fine. If it is too much work to learn how to make it work with that translator I am fine having 2 version of the same translator.
Details:
This is important for me since I use a standalone note as the main note of a topic in zotero, with many URIs like the ones above to link to the many child note each article has. It makes Zotero really useful for me. I using a workaround with excel to get the title of a note and concatenate it with the URI, but there must be an easier way,
I read as much as I could but I couldn't find a answer. I don't know how to code but I can figure stuff out, only I don't have much free time to do so.
Any advice is appreciated!
Even when I tried writing item.noteTitle in different places it didn't work. It just made even item types with links to be set as "undefined". Thank you for your prompt answer though.
function doExport() {
var item;
while(item = Zotero.nextItem()) {
Zotero.write(item.title+" "+"zotero://select/items/");
var library_id = item.libraryID ? item.libraryID : 0;
Zotero.write(library_id+"_"+item.key+"\n");
}
}
item.note
.item.note.replace(/<[^>]*>/g, '').replace(/\n/g, ' ').split(/\s+/).slice(0,10).join(' ')
-Using it conditionally?
For the long term: would you have any advice to share about where should I look up to learn how use that script you suggested conditionally?
So that I can use item.title for most items and that script for notes. Because when I used that script you shared with that translator it displays: "an error occurred when trying to export the selected file" when I use it on non-note types of items.
-Why in Word the AMA bibliography of a note gives the note title?
I am still confused about why in Word when I cite notes in some styles like AMA it returns the title of a note just fine but when I try to generate a bibliography in Zotero or export with quick copy with that style it displays the error of "The item you selected has no references". But oh well...
As to how such titles show up in the bibliography - no idea. Somewhere between zotero and the citation processor, someone decides to create a title from the notes. But it seems unlikely you'll be able to use this to generate titles.