Reverting to previous found set from script
- From: Dave Banbury <Nomail@xxxxxxxxxx>
- Date: Thu, 02 Mar 2006 22:49:57 GMT
Hi guys and girls (if any girls like databases, I don't know!)
I'm new to FileMaker but not to databases in general. It's been some years since I used to write programs in FoxPro, but once I'd got into the swing of things, I found it quite pleasurable. So I think I have a reasonably good aptitude for relational databases and writing programs for them (don't know how many of you know it, but FoxPro Basic wasn't like FileMaker's scripting language - in FoxPro you HAD to include screen logic programming if you wanted your records to pause after 25 lines etc., you also had to rebuild indexes manually!)
So the principles behind relational database operation aren't a problem for me to understand; what I'm having difficulty with is making FileMaker's script steps duplicate what I can do manually.
I won't bother explaining now the context as it's long and complicated and knowing it won't help solve the core problem anyway.
Here's the behaviour I observe with the mouse. If I am in a found set of records, or indeed am looking at all of them, when I click into find mode and enter something which I know can't be found, FileMaker presents an error message and allows me to continue or cancel. If I continue, I am taken to a found set of zero records. If I cancel, I am returned to the previous found or full set of records, whichever I was looking at prior to the failed find request.
It is this last behaviour I wish to duplicate in a script. That is, if I was looking at all the records, I want to be returned to those, or if I was in a found set, I want to go back to that. Clearly a ShowAllRecords script step isn't suitable, since that will wipe a found set.
Here is the part of the script I feel should duplicate this behaviour, but instead I am always taken to a found set of zero records.
Set Variable [ $CurrentProductID ; Value:Product::ID ]
# If the script is not called by a user clicking on a specific ProductOptionID, make sure there are related product options to go to.
If [ Get ( ScriptParameter ) <> "SpecificLookup" ]
Enter Find Mode
Set Field [ ProductOption::ProductID ; $CurrentProductID ]
Set Error Capture [ On ]
Perform Find [ ]
Set Variable [ LastError ; Value:Get ( LastError ) ]
Set Error Capture [ Off ]
If [ $LastError = 401 ]
Beep
Revert Record/Request
Enter Browse Mode
End If
End If
I've tried changing the actions taken in the last If test to deleting the Record/Request and I've also removed the Enter Browse Mode step to no avail. Any pointers where I'm going wrong will be much appreciated.
P.S. Is there a way to export scripts as text from FileMaker Pro?
.
- Follow-Ups:
- Re: Reverting to previous found set from script
- From: Helpful Harry
- Re: Reverting to previous found set from script
- From: ursus.kirk
- Re: Reverting to previous found set from script
- Prev by Date: Re: Auto numbering related records
- Next by Date: Populating Portal Rows via script
- Previous by thread: Re: Auto numbering related records
- Next by thread: Re: Reverting to previous found set from script
- Index(es):
Relevant Pages
|