Jump to content

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

Recommended Posts

Posted

I have scripts with "set error capture on"... When I run a script there are times when there are no records to view. The script continues to run however until I manualy cancel it. I want to be able to have a "show message" step which when no records are found would let the user know.. (I thought this was done with "Status(Current Error).. but I can't sem to get it to work)

thanks

Posted

Set up your scrip like this:

SetError Capture [On]

do your find stuff here

If(Status(CurrentFoundCount) = 0)

. Show Message(There are no records which match your criteria)(OK)

. Show All Records

. Exit Script

End If

do what you want to with the found records

You can also use StatusCurrentError=401 after a find to check if no records were found, but Filemaker generally only remembers the error number until the next script step is completed - whereas the Status(CurrentFoundCount) will work as long as there are no records in the found set, no matter where you place the testing condition.

Posted

This didn't necessarily work.. maybe because I am not specifically performing a find. I have a script with a loop that searches all records based on the value of a field. When records do not meet this criteria, it omits the record. When all records are omitted the script continues in an infinite loop. When reords meet the criteria, it performs fast.. I used your suggestion, but it did not stop the script or display the dialog...

any reason why?

thanks

Posted

It is basically this:

Show all records

Set error capture on

Go to record request first

loop

ifis empty (fiield one)

omit record

else

go to record request next (exit after last)

end loop

if(status(currentfound....)= 0

show message

exit script

Posted

Try:

...

Go to Record [First]

Loop

If [isEmpty(field one)]

Omit Record

Exit Loop If [status(CurrentFoundCount) = 0]

Else

Go to Record [next, exit after last]

End If

End Loop

Posted

This is much better done with a find rather than a loop -- it'll be faster for one thing.

Enter Find Mode []

Set Field [field one, "="]

Omit Record/Request

Set Error capture [on]

Perform Find []

If [status(CurrentError) <> 0]

stuff when no records found or a find error occurs

Else

rest of process

End If

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