Jump to content

Finding a Record with Multiple Criteria


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

Recommended Posts

  • Newbies

I'm frustrated and baffled. I have a test DB with the following data:

bar   foo   value

1      dog  77

2      dog  11

1      jim   33

1      dog  88

2      dog  99




This script works:


show (every record whose cell "bar" = 1 and cell "foo" = "dog" )


correctly showing the values 77 and 88



This script works:


show (every record whose cell "value" > 80 and cell "foo" = "dog")


correctly showing the values 88 and 99



BUT, this script (adding a third criterion) fails horribly:


show (every record whose cell "foo" = "dog" and cell "bar" = 1 and cell "value" > 80)

showing the values 77 and 88.

Repeated tests in this area show me that Filemaker only honors the first two criteria, and blatantly ignores the rest!

SO...how can I do the above? I need the search values to be specified by the AppleScript. In the end, I don't even want to see the values...I really need to calculate the total of a set of records found by values in four different cells.

I know how to do this in SQL, but controlling FileMaker is driving me bonkers. I'd give up, except that this is a legacy database with 28,000 financial records that are very important to my mother. :)

Your help would be greatly appreciated. I figure that using AppleScript to control FileMaker's own 'scripts' for finding records may be the way to go, but I can't figure it out.

Link to comment
Share on other sites

  • 2 weeks later...

So what you tend to do is a AND'ed criteria, what you need to know is that the identifiers database and document references the entire table and the found set respectively, so if your compilation of the script makes a fuzz about more than two criterias in a line, stack them instead:

show (every record whose cell "value" > 80 )

show (every record of document 1 whose cell "foo" = "dog")

show (every record of document 1 whose cell "bar" = 1)

An alternative is to write every cliteria in request 1 and perform a native find.

But why bother doing it in applescript, say if no field is used twice in the query use Set Field in the request on the other hand if you wish to enter several values in the same field, have there since FM6 been an ability to "Constrain Found Set"

--sd

Link to comment
Share on other sites

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