• 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: Chris Espinosa <email@hidden>
  • Date: Thu, 26 Feb 2004 21:35:21 -0800

On Feb 26, 2004, at 8:39 PM, Chap Harrison wrote:

Please tell me I'm just doing something stupid.

Everything was working great with a database of 21 test records. Then I tried it with 1 record.

The following suddenly broke -

set myLI_IDList to ID of (every record whose cell "Price" is not "*")
repeat with myLI_ID in myLI_IDList

Apparently, when only one record meets the criteria, "ID of (every record whose...)" returns a scalar value, not a list. So the repeat statement failed - I was not iterating over a list.

Okay... So I add "as list" -

set myLI_IDList to ID of (every record whose cell "Price" is not "*") as list
repeat with myLI_ID in myLI_IDList

That fixed it!

Next I try it with *zero* qualifying records.

The 'set myLI_IDList...' statement dies with an "object not found". It's only a wild guess, but I'm guessing that an empty set of records is not an object?

Is it time to go to bed, or does AS (or FMP) sometimes really treat "a list of zero items" and "a list of one item" as something other than a list? (That would be... "English-like")

Please, tell me I'm just doing something stupid.

You're not; FMP is. And it's been this way for twelve years or so, and people who script FMP regularly are just used to it, that's all.

The results of 'every record whose' can be one of three things:
- if no qualifying records: no result
- if one qualifying record: a record object specificer
- if more than one qualifying record: a list of record object specifiers

Yes, you have to test for all three, every time. But I'd recommend going to bed first.

Chris
_______________________________________________
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: Gary Lists <email@hidden>
    • Re: AS/FMP: a list of fewer than two records
      • From: Michelle Steiner <email@hidden>
References: 
 >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: AS/FMP: a list of fewer than two records
  • 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