glaser_david Posted April 3, 2002 Posted April 3, 2002 I run a script, that automate one of my daily processes. It executes a find, and perform something if there is a found set, or does not perform anything if nothing is found. The problem arise when no records are found. First, 9i get a message box to notify me 1) is there a way to bypass this message The only way i found to count how many records were found was to execute a loop through the found set, and add 1 to a global field for each record going through the loop. However, if i find 0 records, the loop will still run 1 time and set my global field to 1. 2) any way i can use a function like foundCount, or check how many results were found? here are my scripts: go to record requets page[first] Loop copy[select,"Body#"] Perform Script[subscript.....] <<this is the subscript>> set field global,0 enter find mode paste[select,No style,"Body#"] Perform Find[] Enter Browse mode[] Go to record request page [First] Loop set field[global,global+1] go to record request [exit after last, Next] End Loop if [XXXX::global>0] set field body#, "Body#&"-Revision"&XXXX::global"] end if go to record request page [exit after last, Next] end loop David
glaser_david Posted April 3, 2002 Author Posted April 3, 2002 I guess i'll use cuurent error, to find a 401.
glaser_david Posted April 3, 2002 Author Posted April 3, 2002 I solved the global count, but i still can't bypass the error message saying that no records were found.
Steven H. Blackwell Posted April 3, 2002 Posted April 3, 2002 Order a copy of Rich Coulkombre's book--Special Edition Using FileMAker Pro 5 from Amazon. Set Error Capture-->ON will supress dialog StatusCurrentFoundCount-->tells how may records were found HTH Old Advance Man
RussBaker Posted April 4, 2002 Posted April 4, 2002 David, At the start of your script insert the step SetErrorCapture [On] After the Perform Find[] step code: If Status CurrentError = 401 (do the bits you want if no records were found might include a ShowMessage step to let the user know that no records were found. You may need to Exit the script here as well) Else SetField[Global,Status(CurrentFoundCount) EndIf BTW, I hope you have "[]" after your EnterFindMode step. Russ [ April 03, 2002, 05:07 PM: Message edited by: Russell Baker ]
Fitch Posted April 4, 2002 Posted April 4, 2002 Jeez, I'm frantically scouring my recent posts, and other forums, because, "I know I answered this, where is my post?" Aha! David asked the exact same question on the [email protected] mailing list. Never mind.
Steven H. Blackwell Posted April 4, 2002 Posted April 4, 2002 Don't use DtatusCurrentError=401. use StatusFoundCount=0 HTH Old Advance Man
Kurt Knippel Posted April 4, 2002 Posted April 4, 2002 quote: Originally posted by Old Advance Man: Don't use StatusCurrentError=401. While I usually use the Status ( CurrentFoundCount ) = 0 test, is there some issue with the Status ( CurrentError ) = 401 that causes you to recommend the other method? Or is there some cases where the returned set of 0, but 401 is not generated?
djgogi Posted April 5, 2002 Posted April 5, 2002 quote: Originally posted by CaptKurt: quote: Originally posted by Old Advance Man: Don't use StatusCurrentError=401. While I usually use the Status ( CurrentFoundCount ) = 0 test, is there some issue with the Status ( CurrentError ) = 401 that causes you to recommend the other method? Or is there some cases where the returned set of 0, but 401 is not generated? Just in case you've put some comments before testing for error ,because it would reset current error to 0 HTH Dj
danjacoby Posted April 5, 2002 Posted April 5, 2002 Another plus to using the Status(CurrentFoundCount) and similar items rather than Error Numbers is that you don't have to remember (or keep a list of) what error number means what. It's as much a mindset as a specific answer. I like simple solutions, I do. Paydate_Schedule.zip Paydate_Schedule.zip Paydate_Schedule.zip
Recommended Posts
This topic is 8272 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