Jump to content

Why does «Perform Find» generate a scripting error?


This topic is 1642 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Browsing through my event logs, I am finding weird scripting errors, like:

... Information 645 ...local Schedule "Import Main (every minute 8-20)" scripting error (401) at "Import : Import Main : 36 : Perform Find".

How can a simple «Perform Find» script step (which works just fine in the server scheduled script, btw.) generate a scripting error? Occasions where the FoundSet = 0 should be considered «normal».

I also have found other errors, that shouldn't be errors, like «Go to Record/Request/Page [ Next ; Exit after last ]», when there is no next Record.

What is the best way to prevent this? It’s clogging the log files.

Thanks a lot for any insight!

Gary

 

Link to comment
Share on other sites

When no records are found FM generates an error (as you'll be able to see in the debugger). FMS shows this error in the log, I don't think there's a way to prevent that. I've never found one.

When looping through a set of records, when you reach the last one, and try to go past that, FM again throws an error because you're trying to go past the last record. To prevent that error from showing in the logs, you can use the script step:

Exit Loop If [ Get( FoundCount ) = Get( RecordCount ) ]

Before the Go to Record [Next; exit after last]. You wouldn't need this script step any more, so you could also remove it.

Link to comment
Share on other sites

Thanks, Kaizentu,

it’s not really elegant, but nor is FileMaker scripting. For Loops, I'm ususally using the self resetting loop script from fmstandards, which is pretty cool (see picture). But FileMaker shouldn’t consider these instances as errors.

So, what could prevent the no records found «error» to appear in the event list?

Thanks,

Gary

srdl.jpg

Link to comment
Share on other sites

Instead of using a perform find, you could use the schema instead. Using a global (or multiple, depending on what you need, or use a multi value global) create a relationship that matches what your perform find criteria, then do a GTRR and you have your found set. When you set the global you can first check if there are any records and then do the GTRR. This way you wouldn't get an error if there are no records.

Edited by OlgerDiekstra
Link to comment
Share on other sites

This topic is 1642 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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