Script to Find field=(this or that)

  • Follow


I just want to make a filemaker script to create a found set containing all
records where Status is New or Alert.

I created three sub-scripts:

FindNothing: Perform Find [Replace found set].  (Find criteria is impossible
value).  This is to empty the found set.

FindNew: Perform Find [Extend found set].  (Find criteria is Status=New).
This is to add 'New' records to the found set.

FindAlert: Perform Find [Extend found set].  (Find criteria is
Status=Alert).  This is to add 'Alert' records to the 'New' records in the
found set.

Finally I created a script that simply runs these three sub-scripts in
succession.

The resulting found set is not what I'd expect, but I'm hard-pressed to
describe it.

What would be the smartest way to do this?

Also, sometimes my sub-scripts do not seem to properly remember the find
criteria, although I am clicking "Replace" in the relevant dialog.  How does
one find out what a script thinks its find criteria is?

0
Reply clh (8) 4/18/2004 2:22:05 AM

In article <BCA7507D.1F25%clh@pobox.com>, Chap Harrison <clh@pobox.com>
wrote:

> I just want to make a filemaker script to create a found set containing all
> records where Status is New or Alert.
> 
> I created three sub-scripts:
> 
> FindNothing: Perform Find [Replace found set].  (Find criteria is impossible
> value).  This is to empty the found set.
> 
> FindNew: Perform Find [Extend found set].  (Find criteria is Status=New).
> This is to add 'New' records to the found set.
> 
> FindAlert: Perform Find [Extend found set].  (Find criteria is
> Status=Alert).  This is to add 'Alert' records to the 'New' records in the
> found set.
> 
> Finally I created a script that simply runs these three sub-scripts in
> succession.
> 
> The resulting found set is not what I'd expect, but I'm hard-pressed to
> describe it.
> 
> What would be the smartest way to do this?

I'm not sure why you're doing much of the above, but if I understand
correctly what you're trying to do, then try one script with something
like this:

    Enter Find Mode []
    Set Field [Status, "New"]
    New Record/Request
    Set Field [Status, "Alert"]
    Perform Find []

Depending on what you're trying to do you may want some error checking
in there in case there are no matching records (eg. to give a custom
error message).



> Also, sometimes my sub-scripts do not seem to properly remember the find
> criteria, although I am clicking "Replace" in the relevant dialog.  How does
> one find out what a script thinks its find criteria is?

Stored Find Requests (and the other bits like Sorting) can be useful,
but usually they're just a pain - it's often easier to do a script like
the above where you can manual set your needs in the script instead.

The only way you can see what's actually stored for Finds, Sorting,
etc. is to print (or print preview) the script.



Helpful Harry                   
"Hopefully helping harassed humans happily handle handiwork hardships"  ;o)
0
Reply Helpful 4/18/2004 3:33:27 AM


In article <180420041533277807%helpful_harry@nom.de.plume.com>, Helpful
Harry <helpful_harry@nom.de.plume.com> wrote:

>In article <BCA7507D.1F25%clh@pobox.com>, Chap Harrison <clh@pobox.com>
>wrote:
>
>> I just want to make a filemaker script to create a found set containing all
>> records where Status is New or Alert.
>> 
>> I created three sub-scripts:
>> 
>> FindNothing: Perform Find [Replace found set].  (Find criteria is impossible
>> value).  This is to empty the found set.
>> 
>> FindNew: Perform Find [Extend found set].  (Find criteria is Status=New).
>> This is to add 'New' records to the found set.
>> 
>> FindAlert: Perform Find [Extend found set].  (Find criteria is
>> Status=Alert).  This is to add 'Alert' records to the 'New' records in the
>> found set.
>> 
>> Finally I created a script that simply runs these three sub-scripts in
>> succession.
>> 
>> The resulting found set is not what I'd expect, but I'm hard-pressed to
>> describe it.
>> 
>> What would be the smartest way to do this?
>
>I'm not sure why you're doing much of the above, but if I understand
>correctly what you're trying to do, then try one script with something
>like this:
>
>    Enter Find Mode []
>    Set Field [Status, "New"]
>    New Record/Request
>    Set Field [Status, "Alert"]
>    Perform Find []
>
>Depending on what you're trying to do you may want some error checking
>in there in case there are no matching records (eg. to give a custom
>error message).


This is the way to go.  But to elaborate a little for the original
poster's benefit (who sounds like a newbie), you only need to do one find,
not three.  Your first find "empties the found set" by finding something
impossible.  There is no need to do this, as any find always works on all
records, regardless of how many found records are currently available, or
"on display."

The next two finds tended to cancel each other out.  You run a find for
"New" and this is what you get.  Now you run a different find for "Alert",
and as the find works on all records, you will lose the "New" batch and
end up with only records that have "Alert".

When you run three different find scripts in a row like that, the result
is as if you had run only the last script by itself.  Harry is showing you
how to get the job done by making two different requests within the same
find, to get either "New" or "Alert."

Steve Brown
0
Reply eyebrown 4/18/2004 12:15:12 PM

On 4/18/04 7:15 AM, in article
eyebrown-1804040814360001@sdn-ap-021tnnashp0325.dialsprint.net,
"eyebrown@mindspring.com" <eyebrown@mindspring.com> wrote:

> In article <180420041533277807%helpful_harry@nom.de.plume.com>, Helpful
> Harry <helpful_harry@nom.de.plume.com> wrote:
> 
>> 
>>    Enter Find Mode []
>>    Set Field [Status, "New"]
>>    New Record/Request
>>    Set Field [Status, "Alert"]
>>    Perform Find []
>> 
> This is the way to go.  But to elaborate a little for the original
> poster's benefit (who sounds like a newbie), you only need to do one find,
> not three.  Your first find "empties the found set" by finding something
> impossible.  There is no need to do this, as any find always works on all
> records, regardless of how many found records are currently available, or
> "on display."

Re: newbie - guilty as charged! ;-)

Harry's procedure worked just fine.  And thanks, Steve, for the elaboration
on Finds.  I was stumbling around through the scripting commands without a
roadmap or a clue.

Thanks to both of you.

Chap

0
Reply Chap 4/18/2004 12:44:14 PM

In article <180420041533277807%helpful_harry@nom.de.plume.com>,
 Helpful Harry <helpful_harry@nom.de.plume.com> wrote:

> In article <BCA7507D.1F25%clh@pobox.com>, Chap Harrison <clh@pobox.com>
> wrote:
> 
> > Also, sometimes my sub-scripts do not seem to properly remember the find
> > criteria, although I am clicking "Replace" in the relevant dialog.  How does
> > one find out what a script thinks its find criteria is?
> 
> Stored Find Requests (and the other bits like Sorting) can be useful,
> but usually they're just a pain - it's often easier to do a script like
> the above where you can manual set your needs in the script instead.
> 
> The only way you can see what's actually stored for Finds, Sorting,
> etc. is to print (or print preview) the script.

Unless, of course, you have FileMaker Developer. I use Debug Script past 
the Find point, exit the script and Refind to see what my find criteria 
are.

Clumsy, but more on the fly than a print or print preview.

--Lisa
0
Reply Lisa 4/19/2004 4:01:46 PM

4 Replies
319 Views

(page loaded in 0.08 seconds)

Similiar Articles:













7/9/2012 10:14:53 AM


Reply: