Extract parent ID from classify

Using

tell application id "DNtp"
	set theRecord to selected record 1
	set mainClass to classify record theRecord
	set mainClass to item 1 of mainClass
	set mainDB to id of database of mainClass
	set mainPar to id of parent of mainClass
end tell

The replies are:

get selected record 1
		--> content id 261422 of database id 1
	classify record content id 261422 of database id 1
		--> {parent id 25765 of database id 2, [...]
	get id of database of parent id 25765 of database id 2
		--> 2
	get id of parent of parent id 25765 of database id 2
		--> {2.147483645E+9}

Can somebody please explain why the id of parent of parent id 25765 is 2.147483645E+9 rather than 25765? And/or how to extract 25765 from mainClass?

Thanks :slight_smile:

Didn’t check but I think that’s the database’s id.

Querying the id of the database correctly returns 2, so I don’t think so.

Ah, missed that. It looks like what is returned for root:

tell application id "DNtp"
	set theDatabase to current database
	
	set theDatabase_ID to id of theDatabase
	--> 2		
	set theDatabase_Root to root of theDatabase
	--> parent id 2.147483645E+9 of database id 2
end tell
1 Like

Um, ok, thx :slight_smile: That is the answer to the question “why” - sort of (because I’m not sure I understand why that is the id of root). And, um, how do I make it say 25765? :see_no_evil: I mean, I could use offset, but I was kind of hoping to extract it directly.

Do you want to get the mainClass’s id ?

tell application id "DNtp"
	set theRecord to selected record 1
	--> content id 1801922 of database id 1
	set mainClass to classify record theRecord
	--> {parent id 1828925 of database id 1, parent id 275106 of database id 1, […]}
	set mainClass to item 1 of mainClass
	--> parent id 1828925 of database id 1
	set mainClass_ID to id of mainClass
	--> 1828925
end tell
1 Like

It would seem I do :sunglasses: nice one, thx :+1:t3:

1 Like