# Trying to compare record to a given database

**URL:** https://discourse.devontechnologies.com/t/trying-to-compare-record-to-a-given-database/24727
**Category:** Automation
**Created:** [November 18, 2018, 9:46pm UTC](https://discourse.devontechnologies.com/t/trying-to-compare-record-to-a-given-database/24727 "2018-11-18T21:46:45Z")
**Posts on this page:** 1
**Showing post:** 22

<div class="post-metadata">

### Author: ![pete31](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/p/d26b3c/32.png) [@pete31](https://discourse.devontechnologies.com/u/pete31)
#### Post date: [October 6, 2020, 2:32pm UTC](https://discourse.devontechnologies.com/t/trying-to-compare-record-to-a-given-database/24727/22 "2020-10-06T14:32:48Z")

</div>

I’m trying to compare with `record` instead of `content` but it only returns results of the current database.

```auto
tell application id "DNtp"
	try
		set theRecords to selection of viewer window 1
		if theRecords = {} then error "Nichts ausgewählt."
		
		set thisRecord to item 1 of theRecords
		set theDatabases to databases
		set allSeeAlsoResults to {}
		
		repeat with thisDatabase in theDatabases
			
			#set theContent to plain text of thisRecord
			#set theResults to compare content theContent to thisDatabase --> all databases
			#set allSeeAlsoResults to allSeeAlsoResults & theResults
			
			set theResults to compare record thisRecord to thisDatabase --> only current database
			set allSeeAlsoResults to allSeeAlsoResults & theResults
			
		end repeat
		
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
		return
	end try
end tell

```

---

_[View the full topic](https://discourse.devontechnologies.com/t/trying-to-compare-record-to-a-given-database/24727)._
