Reverting to previous found set from script



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?
.



Relevant Pages

  • Re: Previous record
    ... I'm looking for some help with FileMaker Pro 4 on a Mac.... ... The same Script could then Export the records, ... First perform a Sort and Export manually so that FileMaker knows what ... to be able to compare it with each record through the loop. ...
    (comp.databases.filemaker)
  • Re: forcing re-index
    ... I'm actually a fairly experienced filemaker developer. ... Is there a way that I can force indexing to re-occur everytime the contents of a field is changed, with a script step, or by using some script step that indirectly causes re-indexing to occur. ... In this case, I CAN associate a script step with leaving the field, because the field only occurs in a special window that comes up, and the user has to click a button to close that window. ...
    (comp.databases.filemaker)
  • Re: "This script cannot be found or has been deleted."
    ... There have not been any widely reported problems in this regard, but it might be worth a call to FileMaker tech support to check with them. ... One difference between FM6 and FM8 is that in FM6 each script was saved as you exited the script. ... The file I was working with is on a very capable Dell server running FM ...
    (comp.databases.filemaker)
  • Re: Need guidance
    ... Close all databases that are being shared by FM7 sever. ... Open FM7 pro 7 to execute a script that will import data from another file ... Open all databases in FM7 server to be shared. ...
    (comp.databases.filemaker)
  • Re: Help needed with creating three columns of checkboxes
    ... You don't provide your FM version or platform (specific version is ALWAYS important in asking a question about FileMaker, platform only sometimes, but do it anyway); answer assumes 7 or greater, either platform. ... Yes, having a set of "template" records in Parts, pre-populated with the part numbers, would be one way to go. ... fields to create a checkbox set effect. ... I could not see among the script functions "copy Record ...
    (comp.databases.filemaker)