Jump to content

No records found = 401 = Filemaker script error


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

Recommended Posts

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
Link to comment
Share on other sites

  • 9 months later...

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.

Link to comment
Share on other sites

  • 4 months later...

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 ) ]
Link to comment
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

Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

This topic is 3794 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.