still_learning2008 Posted March 11, 2009 Posted March 11, 2009 Hi there, I have a few scripts in which I'd like to search for the presence of certain records in certain tables. If no records are found, I'd like one thing to happen, if records are found, I'd like something else to happen, all behind the scenes and invisible to the end user. There are a few different scenarios on our DB where this would be helpful. The issue I run into is that when no records are found, the script is stopped and a message is displayed saying no records were found that match the search criteria, with the button choices of what to do next. Is there any way to suppress this dialogue, or any other way to deal with empty search results? I've tried using logic like when Get(FoundCount) = 0, but to get the found count it still needs to perform the search first, which displays the dialogue. An example of this: on a certain layout users can click checkboxes for multiple records that, when checked and a "process" button is clicked, will initiate a certain action on those records. However, before I present the users with the list of records, I'd like to do a quick search to make sure no records are checked already (and if they are to un-check them), something I could see happening if a previous user closed the application or somehow left the layout during the above workflow. Any thoughts / ideas much appreciated!
bcooney Posted March 11, 2009 Posted March 11, 2009 You can suppress the dialog by adding Set Error Capture On at the beginning of the Find script.
still_learning2008 Posted March 11, 2009 Author Posted March 11, 2009 Excellent, and so simple I'm a little embarassed - thanks, will give this a shot!
bcooney Posted March 11, 2009 Posted March 11, 2009 Be careful. Now that you've turned Error Capture On, be sure to trap and handle any errors.
LaRetta Posted March 11, 2009 Posted March 11, 2009 I've tried using logic like when Get(FoundCount) = 0, but to get the found count it still needs to perform the search first, which displays the dialogue. And this is what Barbara means about trapping for errors. Now that you realize you can use Set Error Capture [ On ], you need to figure out what to do after your find. So it would look something like this: Set Error Capture [ On ] Perform Find [ stored find request ] If [ not Get ( FoundCount ) ] ... no records found. Show All Records Go To Layout [ original layout ] Exit Script End If ... records found - do whatever you wish.
Recommended Posts
This topic is 5735 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