April 14, 200322 yr I want to perform a find and if the result of the find is "no records found", then have the program ask a question "Do you want to do another find?" and have the option of picking "yes" or "no" for the answer and depending on the answer perform a script. Is this possible?
April 14, 200322 yr Use a script like: Set Error Capture [On] # do you find stuff here If [status(CurrentFoundCount) = 0] . Show Message [sorry, didn't find anything. Do you want to do another find?] [Yes] [No] . If [status(CurrentMessageChoice) = 1] .. # do the stuff here if they do want another find . Else .. # do the stuff here if they don't want another find . End If Else . # do what you want with the records which were found End If
April 14, 200322 yr You could do this with a script: set error capture on loop enter find mode pause perform find if [status(currenterror)<>0] show message "No records found, would you like to perform another find? (button1 ="yes", button2="No") if [status(currentmessagechoice)=2] exit loop] end if else exit loop end if end loop enter browse mode syntax might be a bit off, but it is the basic idea. HTH -Raz
April 14, 200322 yr Hi Dobbers, This question comes up very often, and always get the same answer. Let me make another suggestion. 1.Find or Relationship ? When you program a scripted find, there are great chances that this find could be replaced by a single relationship validation, which is [quicker . ex : check for invoices dues for the customer. a global field = 1 in the Customer file a concanate calc field = Customer_Id & " "&global a calc c_invoicedues = Case(InvoicePaid = "Yes", 0, 1) a concanate calc field in Invoices db = Customer_Id & " "&c_invoicedues Relationship ----> LookToInvoiceDues = Customer:Concanate::Invoices:Concanate Then the classic "do some stuff and perform find" could be changed to If not Valid(LookToInvoiceDues) Show Message.... 2. The Message and the script(s) to trigger depending on the result of the find/relationship : There are currently 3 maximum choices (I may be wrong) in a Show Message Dialog Box. So instead of using the "Yes" or "No", you could have a Message : "There are currently no records matching your request" Choices : 1. Abort 2. Perform Script 2 3. Perform Script 3 which allows you to trigger 2 different scripts. or switch from the Show Message Script step to a smoother solution involving either : - A layout for messages with as many scripts as you want to trigger - A message appearing within the user interface according to the result of the script. Of course, both solution proposed by Raz and Russ are working fine for classic finds....
Create an account or sign in to comment