Extracting a key and value for a single property

I’m trying to extract a single key-value pair from a property list, and get the individual key and value separately. However, I’m running into the following problem:


put the keys of parameters
(buildId,ldapId,status,testCaseId)
put the keys of item 1 of parameters
()
put the keys of items (2,3) of parameters
()
put  items (2,3) of parameters
( ldapId:"mattstone", status:"Pass")

As you can see, I can get the keys of the entire parameter list, but not for a subset of the list

Any ideas?

Thanks,

Matt Stone

I think I have narrowed down this bug:

put item 1 of parameters
(buildId:“16100”

should be

put item 1 of parameters
(buildId:“16100”)

Then,
put the keys of (buildId: “16100”)
(buildId)
put the values of (buildId: “16100”)
(16100)

will work instead of

put the keys of (buildId: “16100”
in :
Syntax Error at line 1: Syntax Error - can’t understand “[end of script]” at or near character 34

The problem here is that you’re trying to treat a property list as a list. The name “property list” may be misleading in this case, as a property list is a fundamentally unordered collection of keys and values – so it’s not really a “list” which is an ordered collection of unlabeled values (I hope that’s clear!).

The keys() and values() functions will return ordered lists of either the keys or values of a property list, though, so you can extract a single key or value using something like the reverse of what you’re trying now – instead of “the keys of item 1”, try:

put item 1 of the keys of parameters

You can also get more than one:

put items 2 to 3 of the keys of parameters

I hope this helps make it more clear.