April 3, 200223 yr 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
April 3, 200223 yr Author I solved the global count, but i still can't bypass the error message saying that no records were found.
April 3, 200223 yr 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
April 4, 200223 yr 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 ]
April 4, 200223 yr 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.
April 4, 200223 yr 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?
April 5, 200223 yr 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
April 5, 200223 yr 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
Create an account or sign in to comment