continue a script if a find is empty

is there a way to force a script to continue running after having an empty find? the scenerio is:

i have 4 databases
i have a layout that includes fields from each database
i have a field named selected record in each of the 4 databases
i do a search on each database and mark the selected record field with a 1
i do a find on each database for records with selected records = 1
the script runs fine and returns my desired results if there is at least one record in each database.
however if the find returns empty i get a "modify find or cancel" box.
when i hit cancel the script stops running.
Who is Participating?
lesouefConnect With a Mentor Commented:
so just remove the else condition....
but I think
if (Get(TotalNumberofRecords)>0) is wrong, he probably meant
if (Get(FoundRecords)>0)
otherwise it does not make sense to do this after a find

Yes, and it is fairly easy. You set manual error handling=on.
You can do that just before the searching and reset afterwards.

It practically means you dont get the dialogs and have to check for >0 found records yourself.

I dont have an english version, so I am uncertain about how the script in english.

with a smile
kauakeaAuthor Commented:
the purpose of the script is to find all the records with selected records = 1 in all the databases and include them on a layout that i can run a report on.
what does check for >0 found records mean?
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

prifreConnect With a Mentor Commented:

Manual errorhandling->On
#use the below two if you know what to search for (as for example "Selected record" = "1")
Set Field ("Selected record","1")

Preform Find[]
If (Get(TotalNumberofRecords)>0)
   #preform whatever is to be handled if you fond the records
   #for example replace all field contents of Selected record with 1...
    Replace (No dialog, Selected record,1)
   #preform whatever to do if you did not find any records
End If
Manual errorhandling->Off

(The above is how I would write the script... but it is what I guess it is, since I run a Swedish FileMaker and I have translated from swedish to English... So I might have misspellt.)

anyhow - hope the above helps!

with a smile
kauakeaAuthor Commented:
the if statement would work for <1 because if it finds a record a have no problem, but what i want it to do if no records are found is continue the script and the find operations.
the script says:
if we find some records, we do one thing, but if we find no records, we do a second thing.
What you actually do is up to you!

you write: "if no records are found is continue the script and the find operations. " 
Does that mean you want the user to be back into find-mode and change the search criteria?
Then add "Enter Find" and "Exit Script" after "Else" in the script!

The point is with Manual errorhandling and checking Get(TotalNumberOfRecords)=0 you can yourself control what should happen if no records are found or more than 0 records are found etc. Scriptwise.

with a smile
kauakeaAuthor Commented:
the result i am trying to get is to run the script without any user intervention. i would like the script to continue even if one of the databases returns no finds on the marked selection = 1 from the find request

lesouef is quite correct. I mixed up Get(TotalNumberRecords) and Get(FoundRecords).
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.