• 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: does property exists in a record
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: does property exists in a record


  • Subject: Re: does property exists in a record
  • From: Helmut Fuchs <email@hidden>
  • Date: Fri, 10 Aug 2001 17:11:21 +0200

At 0:33 Uhr +1000 11.08.2001, Adam Hinshaw wrote:
is there a way then to coerce a string to a record property ??

You can use the run script command from the Standard Additions for this purpose:

set aSymbolName to "that's a funny symbol"
set aRecord to {anEntry: anything}
set aRecord to aRecord & (run script "{|" & aSymbolName & "|: anything}")

==> {anEntry: anything, |that's a funny symbol|: anything}

But as far as I know there's no way back, i.e. no way to coerce the symbols back to strings - rendering this method useless when it comes to using arbitrary symbols. And from what I understand that's just what you want to do: create arbitrary properties in records and be able to read them.

If you know that the properties you are searching for are from a limited subset, you at least can check for existence _if_ you know the value this contains:

set bRecord to (run script "{anEntry: anything}")
aRecord contains bRecord

==> true

In NewtonScript symbols (in our case "property names") were just another datatype, so it was easy to iterate through records and do whatever you want with them. Maybe somebody out there knows of a simple method to do just that?

Helmut
--


References: 
 >Re: does property exists in a record (From: Adam Hinshaw <email@hidden>)

  • Prev by Date: Script losing their paths to Standard Additions
  • Next by Date: Excel Bug
  • Previous by thread: Re: does property exists in a record
  • Next by thread: Re: does property exists in a record
  • Index(es):
    • Date
    • Thread