Find & Goto parent groups of all replicants of an item

A much simpler and useful version after a suggestion from @cgrunenberg in this post Experimental: Script to trace a backlink. All groups containing the replicants of an item will be shown in the viewer window. No advance search predicates in search field can produce this result - the DT dictionary is really comprehensive!

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

-- ngan 2019.08.21

tell application id "DNtp"
	try
		if exists (content record) then
			set theDoc to content record
		else if (count of the selection) > 1 then
			set theDoc to item 1 of ((the selection) as list)
		else
			error ("No document is selected. Please select a document, then try again.")
		end if
		
		set theParents to (parents of theDoc whose tag type is not ordinary tag)		
		set search results of viewer window 1 to theParents		
	end try	
end tell
1 Like