dbTalk Databases Forums  

Scripting a Find

comp.databases.filemaker comp.databases.filemaker


Discuss Scripting a Find in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Buckbuck
 
Posts: n/a

Default Scripting a Find - 11-10-2010 , 11:21 AM






FM8.5

I am trying to create a script that will select a specified group with
several parameters
These are:

Country is "Canada" or Ship to Country is "Canada"
and
The Create Date is greater than g_Comparative Date
and
The HST submitted value is not equal to "Yes"

Can anyone advise me here. When I do a Perform Find it is selecting
only fields that satisfy all conditions.

Thanks
Matthew

Reply With Quote
  #2  
Old   
Christoph Kaufmann
 
Posts: n/a

Default Re: Scripting a Find - 11-10-2010 , 02:16 PM






Buckbuck <buck.matthew74 (AT) yahoo (DOT) com> wrote:

Quote:
I am trying to create a script that will select a specified group with
several parameters
These are:

Country is "Canada" or Ship to Country is "Canada"
and
The Create Date is greater than g_Comparative Date
and
The HST submitted value is not equal to "Yes"

Can anyone advise me here. When I do a Perform Find it is selecting
only fields that satisfy all conditions.
Forget the script for a moment and try the find directly. Go to find
mode and enter all the condition without the "ship to country".

Before clicking find, duplicate this request (Cmd-D or Ctrl-D)

You have a second request now. Empty the Country field and put "Canada"
in the Ship to Country field.

Press Enter and Click find.

If it works, go to the script and put the find step in, check the box to
specify the request. The find you have just done will already be there.

--
http://clk.ch

Reply With Quote
  #3  
Old   
Your Name
 
Posts: n/a

Default Re: Scripting a Find - 11-10-2010 , 06:12 PM



In article
<e0a197e2-6181-4243-a967-c8b4c3a7c513 (AT) u25g2000pra (DOT) googlegroups.com>,
Buckbuck <buck.matthew74 (AT) yahoo (DOT) com> wrote:

Quote:
FM8.5

I am trying to create a script that will select a specified group with
several parameters
These are:

Country is "Canada" or Ship to Country is "Canada"
and
The Create Date is greater than g_Comparative Date
and
The HST submitted value is not equal to "Yes"

Can anyone advise me here. When I do a Perform Find it is selecting
only fields that satisfy all conditions.
Scripted Find are done the same way you do them manually.

In this case there are really three different Finds ("Or"), each of which
use a combination of Fields ("And"), plus the added "Not". For that you need
three Find Requests.

The "Not" Find might be able to be done as a "And", but it depends on the
possible data in the HST Field (e.g. instead of Not "Yes" you could use
And "No"). I'll stick with "Not" just in case there are other possible
values, including blank data.

Manually you would:
- enter Find Mode,
- type "Canada" into the Country Field
- type "> date" (where 'date' is an actual date) into the
Create Date Field
- create a new Find Request
- type "Canada" into the Ship to Country Field
- again "> date" into the Create Date Field
- create a third Find Request
- type / enter "Yes" into the HST Field
- click on the Omit option in the side Status Bar
- perform the Find

This process gives you the Script you need.
i.e.
Enter Find Mode []
Set Field [Country; "Canada"]
Set Field [Create Date Field; ">" & g_Comparative Date]
New Record / Request
Set Field [Ship to Country; "Canada"]
Set Field [Create Date Field; ">" & g_Comparative Date]
New Record / Request
Set Field [HST, "Yes"]
Omit Record
Perform Find []

Make sure that the two Find commands are not set to Pause and not set
to Restore saved Requests

Note:
There is a slight hiccup here. I'm not sure if they've fixed it in newer
versions of FileMaker, but in older version you cannot use the Set Field
command if working with Finds of dates and times that require the symbols
">", "<", "<>", "...", etc. In these cases you have to use a workaround with
the Insert Calculated Result command instead.
i.e.
replace
Set Field [Create Date Field; ">" & g_Comparative Date]
with
Insert Calculated Result [Create Date Field; ">"
& DateToText(g_Comparative Date)]

The DateToText function is now one of the Get functions in newer versions
of FileMaker.


Helpful Harry )

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.