Jump to content
Sign in to follow this  
liltbrockie

No records found = 401 = Filemaker script error

Recommended Posts

Any way to surpress the error message when you have a script that searches and finds nothing when run from the server? Its not an error it just hasnt found any records!

Share this post


Link to post
Share on other sites

Turn error capture on. It's a script step.

Edit: oops, the "server" part didn't register!

  • Like 1

Share this post


Link to post
Share on other sites

If you are referring to the error FileMaker server logs, then no, not that I'm aware of.

Share this post


Link to post
Share on other sites

Turn error capture on. It's a script step.

It's on.

If you are referring to the error FileMaker server logs, then no, not that I'm aware of.

ridiculous... lol Sort it out Filemaker.

Share this post


Link to post
Share on other sites

After your find request...

If Get(lastError) > 0

action for failed find

Else

action for successful find

End

Share this post


Link to post
Share on other sites

After your find request...

If Get(lastError) > 0

action for failed find

Else

action for successful find

End

This does not surpress error messages in the main schedule screen

Share this post


Link to post
Share on other sites

This is kind of janky, but you have to insert in a script step that guarantees no error code thrown (like "Show All Records") and then exit the script using the "Exit Script" step.

ie.




If Get(lastError) > 0

  action for failed find

  Show All Records

  Exit Script

Else

  action for successful find

End If



If you have multiple "Perform Find"s, make sure you add the "If Get(lastError) > 0" right after the Perform Find and then "Show All Records" and "Exit Script" steps after your other script steps but before the "End If" or "Else" script step.

This suppresses the error in the schedule section of FMS

  • Like 4

Share this post


Link to post
Share on other sites

My server side master script calls three scripts, each of which ends with a Find All Records step.  If the script specific find does not find any records it jumps to the Find All Records steps and ends.  

 

The FMS 12 server side logs faithfully records each of the 3 called scripts as having a 401 error in spite of the non-erroring Find All Records step at the end.

 

I too would love to get rid of these logged errors.

Share this post


Link to post
Share on other sites

You also get a logged error at the end of every loop. (Go to Next, Exit after Last).

Share this post


Link to post
Share on other sites

You also get a logged error at the end of every loop. (Go to Next, Exit after Last).

 

From: http://www.databuzz.com.au/an-approach-to-filemaker-server-side-script-debugging/

 

You can use the following step immediately above the Go to Record/Request/Page [ Next ] step to bypass this:

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

Share this post


Link to post
Share on other sites

 

From: http://www.databuzz.com.au/an-approach-to-filemaker-server-side-script-debugging/

 

You can use the following step immediately above the Go to Record/Request/Page [ Next ] step to bypass this:

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

 

… but if you do that, you should set a variable to the value of Get ( FoundCount ) before starting the loop and check on that, so Get ( FoundCount ) is only executed once, not for every iteration. 

 

or rather not … see below

Share this post


Link to post
Share on other sites

so Get ( FoundCount ) is only executed once, not for every iteration. 

 

Have you tested this to see if it makes a difference?

Share this post


Link to post
Share on other sites

… but if you do that, you should set a variable to the value of Get ( FoundCount ) before starting the loop and check on that, so Get ( FoundCount ) is only executed once, not for every iteration. 

 

OK; contrary to popular belief (or at least my belief) it doesn't seem to make a difference – and for large data sets the variable method even seems to be slower … any idea why that would be the case?

 

Anyway, thanks for pointing this out.

Share this post


Link to post
Share on other sites

OK; contrary to popular belief (or at least my belief) it doesn't seem to make a difference – and for large data sets the variable method even seems to be slower … any idea why that would be the case?

 

I have only a guess. First, the belief that Filemaker would count the records every time you call for Get(FoundCount) is rather naive; even simple browsing would become unbearably slow if the record counter in the tool bar had to be refreshed that way. It is much more reasonable to assume that the found count is kept in a register (i.e. a dedicated variable) that gets updated only when the found set is actually modified. So one would expect to see very little difference between reading the register compared to reading a $variable. It's even possible that reading the register would be a tad faster - seeing that it's been hard-wired since version 3 if not sooner, while script variables need to be registered and Filemaker must look up the registry before it can retrieve the value.

 

Again, this is no more that a conjecture - but if it's borne out by facts, then it's a good conjecture until someone comes up with a better one.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

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