Quantcast
Channel: DEVONtechnologies Community - Latest posts
Viewing all articles
Browse latest Browse all 16167

Importing Data into Custom Metadata Fields

$
0
0

You’re welcome :slight_smile:

Yes, it can all be done in a single script.
You would need to extend the my searchRecs() handler.

To make it more clear for yourself, you could assign variables, one for each row/column cell you’re using. Those variables are passed to the handler in the my searchRecs() handler call shown here.

			set recName to (get cell at row theRow column "Filename")
			set recCite to (get cell at row theRow column "Cite")
			-- Add other variable assignments as needed, e.g., set recPPP to (get cell at row theRow column "PPP")
			my searchRecs(recName, recCite) -- Don't forget to include other variables when calling this handler

and you need to modify the first line in the handler…

on searchRecs(recName, recCite) -- If you add other variables above, you must also include them in the handler here.

Hopefully, you’ve read and understood the changes I am showing you.


In case it’s unclear, here it is with a little more error-trapping at the front end…

tell application id "DNtp"
	if not (exists (content record)) or (type of (content record) is not sheet) then return
	tell think window 1
			repeat with theRow from 1 to (number of rows)
				set recName to (get cell at row theRow column "Filename")
				set recCite to (get cell at row theRow column "Cite")
				-- Add other variable assignments as needed, e.g., set recPPP to (get cell at row theRow column "PPP")
				my searchRecs(recName, recCite) -- Don't forget to include other variables when calling this handler
			end repeat
	end tell
end tell

on searchRecs(recName, recCite) -- If you add other variables above, you must also include them in the handler here.
	tell application id "DNtp"
		set allMatches to (search "filename: " & recName in (root of current database))
		if allMatches is not {} or (count allMatches is 1) then
			add custom meta data recCite for "Cite" to item 1 of allMatches
		end if
	end tell
end searchRecs

Viewing all articles
Browse latest Browse all 16167

Trending Articles