Loop function to append text in a field
I have a database, Contacts, and a field, Saved Searches (I realize that FileMaker has a saved search function, I can't get that to do what I want it to do). After a user performs a standard search based on specific criteria, there is some subjective decision making that goes into the finalization of a list. I would like to be able to save these lists for reference later across the group. Currently, I have a button called "Save Search" which executes as such:
Show Custom Dialog ["Save Search"] (prompts the user to enter text into the Search Name field)
Go to First Record
Copy [Select, Contacts::Search Name]
Past [Contacts::Saved Searches]
Go to Next Record
Paste [Contacts::Saved Searches]
Now there are a few problems here. The first is that the loop never ends because I don't know how to tell it to stop when it hits the last record in the found set. The second is that the first record often has the search name pasted repeatedly. Ideally, I would like the script to insert a return/new line in the Saved Searches field, then paste the text from Search Name, then move on through the found set until complete. If possible, I would also like to add the Search Name text to a value list of search names so that future users may select them from a drop-down.
Any help is appreciated. Thanks.