LaRetta Posted December 7, 2006 Posted December 7, 2006 I recall an answer posted awhile back but I've searched for 3 hours now and can't find it. User is viewing a found set. Script (button) performs another find. I must provide User with messages and choices if records are found so I need Error Capture [On]. But, by doing so, I lose the prior found set if cancelled (FM only restores the prior found set if *it* handles it). The Exception (if no records found) must return the User to the prior found set. Allow User Abort [ Off ] Freeze Window New Window Set Error Capture [ On ] Perform Find [ Restore ] If [ not Get ( FoundCount ) ] Close Window Show Custom Dialog [ "No records found" ] Halt Script Else Close Window Perform Find [ Restore ] End If ... do whatever with found set I have to Perform Find [ Restore ] twice (same one) and I don't think I have to. Is there a way to close the small window and end up with the found set in the original layout? LaRetta
Fenton Posted December 7, 2006 Posted December 7, 2006 I'm a little boggled. Since the Find is happening in a new window, which is then closed whether the Find is successful or not, it doesn't change the original found set; ie., I didn't need that 2nd Perform Find [Restore]. If the Find was successful, nothing changes on the screen at all; or a message if I put one. If it fails, then I get the Custom Dialog, but nothing else changes; hitting Cancel or OK makes no difference. Neither has any effect on the original found set (kind of the opposite of what you're saying). This is with 8.5; don't know if 8 is different.
LaRetta Posted December 7, 2006 Author Posted December 7, 2006 Hi Fenton, I didn't clarify that the above script is my attempt to make it work - it tests for no records in new window - not my original script. Originally, User is viewing found set in main layout. Script performs find THERE. With Error Capture On, and if find is unsuccessful, the user ends up with no records unless I Show All Records or re-perform the last find. But using another window, if no records are found, I can just close the window and my original found set is preserved. BUT ... if records are found, I want THAT set in my main window. The above script is my attempt to revert to prior found set. Original script is simple: Set Error Capture [ On ] Perform Find [ Restore ] If [ not Get ( FoundCount ) ] Show Custom Dialog [ "No records found" ] Halt Script Else ... proceed with found set - directing User on. End If With this script (and if no records found), the User is left with NO records. It scares them. I could (and do) include a Show All Records but then they have to perform their prior search again. I know I could store the prior found set in a multiline but if I can use another window, then I won't need to. I'm going to try layout switch (from new window) and closing the original (if records found). :wink2:
Fenton Posted December 7, 2006 Posted December 7, 2006 (edited) How about rather than using New Window, using the "save found set in unconnected TOG" method. I think it is the fastest way to temporarily save a found set. All you need is another TOG of your table, and a layout. If the Find is unsuccessful, restore the saved found set. For those who've missed it, here is something I'd written earlier. I didn't come up with this, and I can't find my documentation of who did; had nice write up on their web site, somewhere -? [P.S. Found it, from way back Oct, 2004] http://www.sumware.net/robfm/savingfoundsets.php Here's my take on it: Each Table Occurrence Group (TOG) maintains its own found set. You can transfer a found set from a TO in one to a TO of the same base table in another TOG by using Go To Related Record [], with the relationship being the ONE YOU'RE ON (strange but true), and specifying the Layout of the unconnected one. Then you come back to your original layout and continue processing. This effectively transfers your current found set to the unconnected one, where it is "stored", unaffected by changes to the found set in your current one. We actually use this ability sometimes without really noticing. We use Go To Related Record, and specify a layout which is in another TOG, not connected to the TO of our current layout. FileMaker shows the resulting found set of our relationship. To Restore the found set you just do the opposite. Go to the layout of the stand-alone TO. Then Go To Related Record using ITS OWN TO, and specify our original layout. It transfers the saved found set back to our original layout. Find_wFS.fp7.zip Edited December 7, 2006 by Guest Found URL
Recommended Posts
This topic is 6561 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now