Jump to content

Trouble with complex show records script


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

Recommended Posts

  • Newbies

Riddle me this experts. The following is part of an AppleScript being called from within FM 7 with a perform AppleScript command.

show (records whose cell "Committee" = "MA Thesis" or cell "Committee" = "MS Thesis" and cell "Include/Skip" = "Include")

It runs without error, but only shows records based on the first criteria. If I take off the [color:"blue"] and cell "Include/Skip" = "Include" it properly shows records based on [color:"blue"] "Committee" = "MA Thesis" or "Committee" = "MS Thesis". If I put [color:"blue"]and cell "Include/Skip" = "Include" first, it shows records based on [color:"blue"]and cell "Include/Skip" = "Include" and the first of the other criteria, but ignores records matching the second. This script originally was part of a system working in FM 4.5 and we just recently made the big jump to FM7. Now all my scripts are broken. I

Link to comment
Share on other sites

The show requests need to be split into two seperate show statements which are between a TELL DOCUMENT statement. When they are between a TELL DOCUMENT statement, it finds the first show request first, then looks for the second show request within that found set.

So the script would be as follows:

[color:"blue"]

tell application "FileMaker Developer"

tell document "test"

show every record

show (every record whose cell "Committee" = "MA Thesis" or cell "Committee" = "MS Thesis")

show (every record whose cell "Include/Skip" = "Include")

end tell

end tell

Say your database has only 7 records.

1 MS THESIS INCLUDE

2 MS THESIS INCLUDE

3 MS THESIS

4 MA THESIS INCLUDE

5 MA THESIS

6 BA THESIS INCLUDE

7 BA THESIS

Step A) The first show statement finds all 7 records

Step : The second show statement, looks at those 7 records from in step A, and shows records 1,2,3,4 and 5

Step C) The third show statement then looks at records 1,2,3,4 and 5 from Step B, for the ones which have INCLUDE and returns records 1,2 and 4

Hope it works for you!

Link to comment
Share on other sites

To be honest i don't know if this has changed because of the new file structure in FM7!

The databases we use have alll evolved through fm4, fm5 and fm6. When upgrading to fm7 there needed to be a lot of changes to all the applescripting, specifically to do with how cells are addressed (see my previous posts about cell issues!). The new way is a more "correct" way to do it but i'm so used to the old methods that its taking me a bit of time to get my head round it!

Link to comment
Share on other sites

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