Jump to content
Sign in to follow this  
xtrim

Omit not Omiting???

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

OFCOURSE !!!!!!!!crazy.gif

Now This is much more logical... smirk.gif

Tnx Dude... grin.gif

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Hi Ugo,

Try to make your TEST databse omit both 'RAGNO' and 'ATLAS CONCORDE' and you'll see what I mean.

Regards,

Ernst.

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.