February 1, 201213 yr FM 11 Advanced I always thought that to suppress an error message when no records were found that you needed to have an if statement immediately after the find to capture the error code. I use the following script steps to allow the user to do repeated finds until one of them is successful. It does not even use an If statement, and the error message does not appear if a find fails. It does however use an Exit Loop If statement. Allow User Abort [ Off ] Set Error Capture [ On ] Go to Layout [ “Find customer” (Customer) ] Loop Enter Find Mode [ ] [ Pause ] Perform Find [ ] Set Variable [ $E; Value:Get ( LastError ) ] Exit Loop If [ $E ≠ 401 ] Show Custom Dialog [ Title: "no record"; Message: "The record does not exist. Press OK and try again."; Buttons: “OK” ] End Loop So, what is the correct technique to suppress the No Records Found Error message?
February 1, 201213 yr I always thought that to suppress an error message when no records were found that you needed to have an if statement immediately after the find to capture the error code. No, the error messages are suppressed by Set Error Capture [ On ]. Your script would work the same as: Allow User Abort [ Off ] Go to Layout [ “Find customer” (Customer) ] Set Error Capture [ On ] Loop Enter Find Mode [ Pause ] Perform Find [ ] Exit Loop If [ Get ( LastError ) ≠ 401 ] Show Custom Dialog [ Title: "no record"; Message: "The record does not exist. Press OK and try again."; Buttons: “OK” ] End Loop
Create an account or sign in to comment