AnsweredAssumed Answered

Empty variables in find request; erase last find

Question asked by PeteTheFreeze on Nov 3, 2012
Latest reply on Nov 3, 2012 by schamblee

Title

Empty variables in find request; erase last find

Post

     Hi All,

     I thought I was fairly proficient in using Filemaker (10-11) script, but now I bumped into a problem.

     What I learned to do in order to find a variable is:

     Set Variable[$Var;1]

     Enter Find Mode[]

     Set Field[Table::ID; $Var]

     Perform Find[]

     This works fine. If variables can be empty, I learned that using Set Error Capture[On] made sense:

     Set Variable[$Var;""]

     Set Error Capture[On]

     Enter Find Mode[]

     Set Field[Table::ID; $Var]

     Perform Find[]

     If[Get(FoundCount) = 0]

     Show Costum Dialog["None found!"]

     End If

     But now I spent a while finding the problem in the following:

     Set Variable[$Var1;1]

     Set Variable[$Var2;""]

     Set Error Capture[On]

     Enter Find Mode[]

     Set Field[Table::ID; $Var1]

     Perform Find[]

     If[Get(FoundCount) = 0]

     Show Costum Dialog["None found!"]

     End If

     Enter Find Mode[]

     Set Field[Table::ID; $Var2]

     Perform Find[]

     If[Get(FoundCount) = 0]

     Show Costum Dialog["None found!"]

     End If

     Whereas I am sure there is no empty ID field in my Table, I do not get the Dialog telling me so. Rather, the last find seems to have remembered the first find and perform that when it notices there is no record with an empty ID field.

     My question thus is: what script step do I use to make sure the first find is erased, so that Filemaker doesn't find the same record in the next step where it should (obviously I would say) not find any records?

     Thanks in advance!

Outcomes