Exporting Data from a FileMaker Field as a list for AppleScript

I have a script in FileMaker that gathers all the job numbers of closed jobs. What I need is to copy those job numbers as a list for a applescript to use. How would I go about doing that? As of now, I’m placing the job numbers into a text field in FileMaker as (ex. “99999”,“88888”,“77777”) and I’m copying that field and pasting it into a variable in AppleScript. Thank you in advance. (I hope this makes sense).

Hello,

no extra field needed if you work with the found set


tell application "FileMaker Pro Advanced"
	
	tell layout "aLayoutName" to show
	-- perform Find
	try
		delete every request
	end try
	set reqID to create request
	tell reqID
		set data of cell "aTableOccurrenceName::aFieldName" to "aFieldQuery"
		-- set data of cell "aTableOccurrenceName::aFieldName" to "anOtherFieldQuery"
	end tell
	--
	find
	if (count records) = 0 then return
	
	set ClosedJob_list to {}
	set ClosedJob_list to get data of field "aTableOccurrenceName::theClosedJobFieldName" of current layout
end tell

repeat with thisJob in ClosedJob_list
	--
	display dialog thisJob
	--
end repeat

or

on substitute(s, r, t)
	set s to s as list
	set r to r as list
	set t to t as text
	set tid to AppleScript's text item delimiters
	repeat with i from 1 to count s
		set AppleScript's text item delimiters to s's item i
		set t to t's text items
		set AppleScript's text item delimiters to r's item i
		set t to t as text
	end repeat
	set AppleScript's text item delimiters to tid
	return t
end substitute

tell application "FileMaker Pro Advanced" to set ClosedJob_list to get data of cell "aTableOccurrenceName::theClosedJobFieldName" of current record

set ClosedJob_list to paragraphs of substitute({"\"", ","}, {"", return}, ClosedJob_list)

repeat with thisJob in ClosedJob_list
	--
	display dialog thisJob
	--
end repeat

I will give both these examples a try. Thank you for your help with this.

clemhoff, your second example worked perfectly. I greatly appreciate you helping me. This is going to make my life much easier.