Viewing select Custom Metadata based on document

Hi,

I am sure this is a Newbie question (I am still in the trial period), but since I can’t easily find an answer, I wanted to ask here.

When working with images or PDFs, I’d like to be able to add Custom Metadata to those items in my database. This is straightforward to do, once I’ve defined fields in Settings/Data.

When I go to the Inspector Pane for that item, and the Info sub-pane, I see the Generic/Custom tabs at the top. What I want to be able to do is, when I click on the Custom tab, to only see a subset of Custom Metadata fields. In other words, I want to define various Templates for Custom Metadata (e.g. one for Archival Correspondence, one for Published material, etc) and then be able to choose one of those, so I only see the relevant fields. This is possible, for instance, in Tropy, when working with archival images.

Or is there a much simpler solution (using Annotations?) in DevonThink already built in?

I guess I don’t yet know the accepted practice, but I am sure this is a very common use case.

Thanks for your advice!
JW

This is actually not yet possible but planned for future releases. Right now the setup is global.

Likewise, I only want to see the relevant fields

My “Templates” requirement includes
custom metadata and tags
and additional processing, like
. assigning filename
. moving the record from the Inbox database
. generating a calendar entry for event type notes

I implemented this using an applescript called Process-Inbox
Here’s an example of the code to define the Templates; stored as variable notetypeList

set notetypeList to {}
	set the end of notetypeList to "Actionable             ;vAction;vGoal:;vProject:;"
	set the end of notetypeList to "CommonPlace       ;cCommonPlace;"
	set the end of notetypeList to "Email              ;cEmail;"
	set the end of notetypeList to "Event                   ;Calendar;cEvent;"
	set the end of notetypeList to "Journal                 ;cJournal;"
	set the end of notetypeList to "Home                   ;cHome;"
	set the end of notetypeList to "Manuals              "
	set the end of notetypeList to "News                   "
	set the end of notetypeList to "Receipt                 ;aVendor;cBudget;"
	set the end of notetypeList to "ReceiptPrescription ;aDr;aVendor;cMedical;cBudget-HealthPrescriptions;"
	set the end of notetypeList to "RossPlace              ;cRP;"
	set the end of notetypeList to "Statement             ;aVendor;cBudget;"
	set the end of notetypeList to "StatementCSV         ;aVendor;cBudget-BankAccount;"
	set the end of notetypeList to "SavingsWithdrawal  ;cBudget-SavingsWithdrawal;"
	set the end of notetypeList to "Template               "
	set the end of notetypeList to "ZK                        ;c;"
	
	set theNoteTypes to (choose from list notetypeList with prompt "Specify Note Type" with multiple selections allowed)

Is there an advantage to using set the end of several times over simply assigning the items to the list?

Just the visual presentation

I see. From the code, I guess that you use the first word of every list item as a choice for the user and the rest are semicolon separated tags, metadata, whatever? In that case, I’d like to point out how one could do it better in JavaScript (in my opinion). The same approach (i.e. using an object) might be possible in AppleScript, but I do not know this language well enough.

No language competition here, only a kind of “educational code sample”.

const mapping = {
  "Actionable": ["vAction:", "vGoal:", "vProject:"],
  "Commonplace": ["cCommonPlace"],
  "Email": ["cEmail"],
  "Journal": ["cJournal"],
  "Manuals":[],
  "News: [],
  "Receipt: ["aVendor", "cBudget"],
// etc.  
}
const noteType = app.chooseFromList(Object.keys(mapping).sort(),
        {withPrompt: "Special Note Type", multipleSelectionsAllowed: true});
/* noteType is a list of the user-selected items like "Actionable" etc. */

/* Loop over these items */
 noteType.forEach(type => {
   const tags = mapping[type];

   /* tags is a list of strings associated with the selected item, eg "vAction:", "vGoal:", "vProject:"  for "Actionable" */
  // Do something with the strings in tags
 } 
}

That is, I think, a cleaner structure: A single object (mapping) whose properties (aka “keys”) contain the strings you want to use as an array (aka “list”). No need to split up the list items at semicolons, since they are already separated. No need to sort the user choices alphabetically, since the sort() call in the chooseFromList method takes care of that.

Also, you’d not be limited to strings in the properties (at least in JavaScript) – you could use whatever object you need, even functions. So, if you’d want to rename a file, you’d use the function name like

…
"Actionable": [renameFile, "tag1"],
…

and check for the type of the list item (aka “array element”) instead of relying on a naming convention. Of course, if you use tags and custom metadata in there, you’d still need some kind of naming convention to discern between them.

A more complete sample to illustrate this approach can be found here: Using a single smart rule instead of Hazel (maybe)

I found an AppleScript example here: Getting data from AppleScript record with nested records - AppleScript - Late Night Software Ltd.