According to Apple, the whose
method should allow to drill down into arrays (I think it exists for AppleScript as well). So this
(() => {
const app = Application("DEVONthink 3");
let names = app.databases.records.whose({kind: {"=" : "Gruppe"}}).name();
console.log(names);
})()
effectively (and very nicely, too) gives me the names of all groups in all of my databases:
--> [["Papierkorb", "Tags"], ["Papierkorb", "Eingang", "Tags"], ["Papierkorb", "Eingang", "Tags", "Sync", "Ausgaben", "Angebote", "Kontoauszüge", "Dokumente", "Korrespondenz"], ...]
However, the DT doc clearly states that we should use the type
property because it does not depend on the locale settings. But
(() => {
const app = Application("DEVONthink 3");
app.includeStandardAdditions = true;
const db = app.databases["Bru6"];
let names = app.databases.records.whose({type: {"=" : "group"}}).name();
console.log(names);
})()
returns nothing. Or rather: an array consisting of nine empty arrays:
app = Application("DEVONthink 3")
app.databases.records.whose({_match: [ObjectSpecifier().type, "group"]}).name()
--> [[], [], [], [], [], [], [], [], []]
The same happens with the simplified whose({type: "group"})
. Am I misunderstanding the DT documentation, the working of whose
or committing some other blunder? Or is this a bug somewhere?
Note: When I have the first script (i.e. the one that works) print out the type
properties of the groups, it happily tells me that it is “group” in every case.
And to clarify: The same problem arises with type: "sheet"
(and probably others).
EDIT: The same query works in AppleScript. But there, I have to use a constant named group
(or any
or whatever) instead of a string. So maybe I’ve to use something else but “group”, “any” etc. in JavaScript?