xtrim Posted June 5, 2003 Posted June 5, 2003 Hi I have a script that runs on the current found set: Goto first rec Loop If (sys_id>1000) Omit rec End if goto next rec (exit after last) End loop Sys_Id is calculated unsorted field (un-changeable). The problem is that some record are still not omited. This is a logical step and I don't understand WHY it is "skipping" records. I have to run the script 6-10 time to get rid of all the "bad" records. Any Ideas? P.S I don't want to use "find" because it is tooooooo long.
ernst Posted June 5, 2003 Posted June 5, 2003 Hi XTrim, This is because your script always jumps to the next record, which it does not have to do when a record is omitted. So it should be something like: Goto first rec Loop If (sys_id>1000) Omit rec else goto next rec (exit after last) End if End loop hope this helps, regards, Ernst
xtrim Posted June 5, 2003 Author Posted June 5, 2003 OFCOURSE !! Now This is much more logical... Tnx Dude...
BobWeaver Posted June 5, 2003 Posted June 5, 2003 The way I avoid this is to start at the last record and then each time through the loop Go to Previous record. That way you don't need the else construct. Go to Record/Request [Last] Loop If [some Condition] Omit Record End If Go to Record/Request [Previous, exit after first] End Loop
ernst Posted June 5, 2003 Posted June 5, 2003 Hi Bob, Sorry to be such a bastard, but your construction goes wrong at the 'top' record when ALL records are to be be omitted. When the script has omitted the record before the 'top' record, the 'goto previous record' step makes the loop exit, so the 'top' record does not get omitted. Further, though it seems that the 'else' scriptstep adds a line of code, the actual script runs faster. This is because with the 'else' construction each loopcount does either an 'omit' or a 'goto' step, whilst the other construction does always do a 'goto' step PLUS sometimes an 'omit' step. Again, sorry to be such a pain. And no pun intended... All the best, Ernst.
Ugo DI LUCA Posted June 5, 2003 Posted June 5, 2003 As a matter of fact, I'm also using this structure when I want to omit some records. See the test file. It omits all records with "RAGNO". Actually, in the definitive file, the name is set by a global. TEST.fp5.zip
BobWeaver Posted June 6, 2003 Posted June 6, 2003 Ernst, no problem. I remember having a problem when the top two records had to be omitted, but thought that it occurred in an older version and was fixed in later versions. So, it's good that you pointed it out.
ernst Posted June 6, 2003 Posted June 6, 2003 Hi Ugo, Try to make your TEST databse omit both 'RAGNO' and 'ATLAS CONCORDE' and you'll see what I mean. Regards, Ernst.
Ugo DI LUCA Posted June 6, 2003 Posted June 6, 2003 Hi Enst, Well, as the records in there are either ATLAS CONCORDE or RAGNO, I'd be omitting all records with this kind of script ! With a record count = 0 and the classic message "create a new record", the user would be stuck for long time, as my solution is portal based (selfjoin). Even a button couldn't be activated....so I discovered a big script hole in my file structure. Though, I've added a record with ERNST and triggered the script again. No matter that ERNST bE the first or last record, both RAGNO and ATLAS CONCORDE where omitted. When looking for Omitting ERNST, no matter if ERNST was first and second records. They were omitted also. Hmm...What am I missing here ?
ernst Posted June 6, 2003 Posted June 6, 2003 Hi Ugo, >>Well, as the records in there are either ATLAS CONCORDE or RAGNO, >>I'd be omitting all records with this kind of script ! The point that I'm making is that the script does NOT omit all records. Try it! But remember to delete the 'Ernst' record before you try... The 'No records Present' situation that you would end up with when the script would work correct is one of those strange Filemaker 'features' that have astonished me for long... But that's another story/thread. Regards to all, Ernst.
Ugo DI LUCA Posted June 6, 2003 Posted June 6, 2003 Yes Ernst, I know. The "this kind of script" was referencing yours. Hopefully, mine doesn't omit all records or I would be in great problem because of this 0 records "locker". I got your point. I was just wondering about Bob's saying it doesn't omit the last 2 records...because it surely does. OK, never mind, I keep that if I'd be omitting, I'd use yours but would control that I'm not ending with a 0 record. Thanks.
Recommended Posts
This topic is 7840 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