Teresa Sampaio Posted April 4, 2006 Posted April 4, 2006 Hi, I’ve searched the Forum and found a similar problem (post #198062). I’ve tried the suggested solution, bus it’s not working with me… My script runs like this: Set error capture [on] Enter find mode [] Set field [“mark”, ““open””] Modify last find Set field [“mark_dup”, ““dup””] Go to field [select/perform, “popupmenu field”] Halt script Perform find [restore] If [“Status(CourrentError) = 401”] Show message [“bla bla bla”] If [“Status(CourrentMessageChoice) = 1”] Show all records End If End If So, if the “perform find” results in “0”, I keep getting the message “No records match this request.” Can someone show me what’s wrong? Thanks Teresa Note: I’m Portuguese, so my English is not as good as I’d like, sorry!
Lee Smith Posted April 4, 2006 Posted April 4, 2006 Try moving the [color:red]Set Error Capture (on) step to just before [color:blue]]If [“Status(CourrentError) = 401”] and see if that doesn't do it. HTH Lee
Ender Posted April 4, 2006 Posted April 4, 2006 Try moving the Set Error Capture (on) step to just before ]If [“Status(CourrentError) = 401”] and see if that doesn't do it. That wouldn't help, as the Set Error Capture [ On ] needs to preceed the Perform Find[]. Anyway, I can't see how the script would get to the If[] with the Halt Script in the middle of the Find process. Try removing the Halt Script, or changing it to a Pause Script[] and see if it works.
Teresa Sampaio Posted April 4, 2006 Author Posted April 4, 2006 Thanks Lee and Ender! The tip is great, as the scripts goes like this: Enter find mode [] Set field [“mark”, ““open””] Modify last find Set field [“mark_dup”, ““dup””] Go to field [select/perform, “popupmenu field”] Pause/resume script [] Set error capture [on] Perform find [restore] If [“Status(CourrentError) = 401”] Show message [“bla bla bla”] If [“Status(CourrentMessageChoice) = 1”] Perform script [sub-scripts, “xxxxxx”] End If End If It’s a little different, because I made it as I really want it – if there are no records to be shown, then open a new record (and this as to be performed in a very specific script), and works! Still... it keeps showing the message as it didn’t find any, even if there are records to be shown. Should I start with an If? (but if what??)
Ender Posted April 4, 2006 Posted April 4, 2006 I don't know if will fix it but I see two more problems. You can remove the Modify Last Find step, as you are already in Find Mode[], and you can uncheck the Restore option on the Perform Find [] step, as this would replace whatever criteria the user/script had entered in the previous steps.
Teresa Sampaio Posted April 4, 2006 Author Posted April 4, 2006 Thanks a lot, Ender! It worked! Teresa
Teresa Sampaio Posted April 4, 2006 Author Posted April 4, 2006 Hi again, Ender In the end, it had worked as simple as this: Enter find mode [] Set field [“mark”, ““open””] Modify last find Set field [“mark_dup”, ““dup””] Go to field [select/perform, “popupmenu field”] Pause/resume script [] Set error capture [on] Perform find [restore] View as [view as List] I don’t know why the “list view” makes the difference (perhaps because of the "error capture on"), but it works as simple as I wanted. Of course I wouldn't get there if it wasn't for you guys. Thanks again. Teresa
Ender Posted April 4, 2006 Posted April 4, 2006 I don't know what you changed, but those problems I noted earlier should still be addressed.
Teresa Sampaio Posted April 4, 2006 Author Posted April 4, 2006 I’m sorry, Ender, you’re right! I didn’t copy de final script… In the final one, I suppressed de “modify last find” and “restore” from perform find: Enter find mode [] Set field [“mark”, ““open””] Set field [“mark_dup”, ““dup””] Go to field [select/perform, “popupmenu field”] Pause/resume script [] Set error capture [on] Perform find [] View as [view as List] This is the way it works! My mistake, thanks again.
Vaughan Posted April 5, 2006 Posted April 5, 2006 1) Use the Set Error Capture [off] step sparingly: run the script for as little time as possible with error capture diabled. Do this by explicitly turning error capture back on. 2) Put the error code into a global field or script variable so you can refer to it later in the script if needed. This has to be the very next step after the step being trapped. Enter find mode [] Set field [“mark”, ““open””] Modify last find Set field [“mark_dup”, ““dup””] Go to field [select/perform, “popupmenu field”] Pause/resume script [] Set error capture [on] Perform find [restore] Set Variable [ $error ; Get( LastError ) ] Set error capture [off] If [ $error = 0 ] # no error stuff Else # error occurred stuff Beep If [ $error = 401 ] Show Message [ "No records match that request."] Else Show Message [ "An error occurred."] End If End If
Teresa Sampaio Posted April 5, 2006 Author Posted April 5, 2006 (edited) Thanks for the tip, Vaughan. I thought I could leave the script as it is (since it works), but, as I understand from your response, you recommend that there should be a “set error capture off”. Is that it? It’s not safe to leave it like this? This script will be used very often… In the mean time, I’ll try to make it as you suggest. Just tell me if it is really necessary. Thanks Teresa I just noticed that you suggest “set variable”… I’m working with FM 5, and I think it only exists in FM7… is there another way? Also, it seams to work like this: Enter find mode [] Set field [“mark”, ““open””] Set field [“mark_dup”, ““dup””] Go to field [select/perform, “popupmenu field”] Pause/resume script [] Set error capture [on] Perform find [] View as [view as List] Set error capture [off] Is it bad or can I leave it like this? Edited April 5, 2006 by Guest
Recommended Posts
This topic is 6809 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