• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: AS/FMP: a list of fewer than two records
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AS/FMP: a list of fewer than two records


  • Subject: Re: AS/FMP: a list of fewer than two records
  • From: Michael Grant <email@hidden>
  • Date: Fri, 27 Feb 2004 16:07:58 -0600

On Feb 27, 2004, at 2:01 PM, Chap Harrison wrote:

Here's a test program I used.

tell app "Filemaker Pro"
tell database "LineItems"
count of records whose cell "Price" is "*"
end tell
end tell

When the number of qualifying records is 0, there is an "object not found" error.

Have I missed something here? How can I ask "inoffensively" about the presence of a record?

Also, about this thing of returning three different classes when there are zero, one, or more than one thing -- is this behavior specific to how Filemaker implements the 'whose' clause? Or is it more pervasive?

I think it's a FileMaker thing--I've never run into it anywhere else.

Try this:

tell application "FileMaker Pro"
tell database "LineItems"
exists (record 1 whose cell "Price" is "*") -- returns true or false
end tell
end tell

Or more elaborately:

set matchRecs to {}
tell application "FileMaker Pro"
activate
tell database "LineItems"
try
set matchRecs to matchRecs & (records whose cell "Price" is "*")
end try
end tell
if (count matchRecs) < 1 then
display dialog "Zippo!"
else if (count matchRecs) = 1 then
display dialog "All by its lonesome..."
else
display dialog "Billions and billions sold!"
end if
end tell

Or just run your loop in place of the if block (it shouldn't error even if the list is empty).

Michael

--
Ukonhete v}stup a nastup, dvexe se zavmrajm.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: AS/FMP: a list of fewer than two records
      • From: Chap Harrison <email@hidden>
References: 
 >Re: AS/FMP: a list of fewer than two records (From: Gary Lists <email@hidden>)
 >Re: AS/FMP: a list of fewer than two records (From: Chap Harrison <email@hidden>)
 >Re: AS/FMP: a list of fewer than two records (From: Michael Grant <email@hidden>)
 >Re: AS/FMP: a list of fewer than two records (From: Chap Harrison <email@hidden>)

  • Prev by Date: Re: AS/FMP: a list of fewer than two records
  • Next by Date: Re: Display Dialog
  • Previous by thread: Re: AS/FMP: a list of fewer than two records
  • Next by thread: Re: AS/FMP: a list of fewer than two records
  • Index(es):
    • Date
    • Thread