So, you’d like to put
{ | Hicks, 2004 | | |zu:4247823:UF46F3FJ}
in the metadata for the file
hicks-s-2004-Explaining Postmodernism
This stand-alone JavaScript code should do the trick. I couldn’t really test it, though, lacking the corresponding records (and time).
It requires the CSV document to be currently open in DT’s front most window. The name of the custom metadata field is “cite”, you can set it to whatever you want in the call to addCustomMetaData
.
(() => {
const app = Application("DEVONthink 3");
const docWindow = app.viewerWindows()[0];
const rowCount = docWindow.numberOfRows();
const columnCount = docWindow.numberOfColumns();
for (let i = 2; i <= rowCount; i++) {
const name = docWindow.getCellAt({column: columnCount-1, row:i});
const cite = docWindow.getCellAt({column: columnCount, row:i});
const targetRec = app.search(`name: ${name}`);
if (targetRec.length > 0) {
app.addCustomMetaData(cite, {for: 'cite', to: targetRec[0]});
}
}
})()