Bush Posted March 3, 2005 Share Posted March 3, 2005 Here's the deal: I've a script (FM6.01) that loops through a clump of records and OMITS any with no data (IsEmpty) in a certain field. The script works great. Except for two guys. The same two guys. Always the same two guys. They remain in the list. If I rerun the script, one of the two is OMITted. If I rererun the script, the remaining guy is OMITted. Great, so I call the script 3 times within a larger script and all works as it should. But it's buggin' the HECK outta me. Why would/should the script work once only partially? If it doesn't work for these 2 the first time, why would subsequent iterations make them go away?? I'm buggered, frankly, and it's bothering me. And the other programmers are laughing at me. Well, at Filemaker. Thanks. Link to comment Share on other sites More sharing options...
Maarten Witberg Posted March 3, 2005 Share Posted March 3, 2005 what if you omit using isempty(trim(field)) ? otherwise, fm6.0v4 is the most recent incarnation of 6. Maybe...... kjoe Link to comment Share on other sites More sharing options...
-Queue- Posted March 3, 2005 Share Posted March 3, 2005 It's possible your loop is faulty. Make sure it is set up like Go to Record/Request/Page [First] Loop If [isEmpty(field)] Omit Record Else Go to Record/Request/Page [Exit after last, Next] End If Exit Loop If [not Status(CurrentFoundCount)] End Loop A common mistake is to include the Go to Record/Request/Page step with the Omit, instead of making it an Else step. When a record is omitted, the following record is already selected, so a GTRRP causes you to skip one record each time one is omitted. A sound omit loop should produce the same results each time. If it doesn't, this is probably the issue. Link to comment Share on other sites More sharing options...
Bush Posted March 3, 2005 Author Share Posted March 3, 2005 Interesting.. the loop is as follows: Go to record (first) Loop If IsEmpty(field) Omit Record End If Go to next record (exit if last) End Loop This seems to work fine for all my looping needs, 'cept here. Is the lack of Else the problem? Few minutes later, the answer is: YES. The script works as advertised. Thanks, Queue. It never occured to me that my implied ELSE wasn' actually functioning as I wished/desired. Link to comment Share on other sites More sharing options...
-Queue- Posted March 3, 2005 Share Posted March 3, 2005 No problem. I spent hours on this problem years ago, and will never forget the epiphany moment when it finally clicked. I'm glad it was a simple fix. Link to comment Share on other sites More sharing options...
Inky Phil Posted March 4, 2005 Share Posted March 4, 2005 Queue, that has answered a problem that I gave up on a long time ago ( used a work around) but not knowing why it didn't work has bugged me ever since Many thanks Phil Knowing what I know now, maybe I should start agin........ Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.