Re: Parsing Records and Lists
Re: Parsing Records and Lists
- Subject: Re: Parsing Records and Lists
- From: Andrew Oliver <email@hidden>
- Date: Sun, 11 May 2003 21:31:23 -0700
What you're getting back is a list containing other lists, so it's just a
matter of drilling down to the fields you want.
For example:
set soapResult to {{|entityName|:"Link", |globalID|:{|entityName|:"Link",
|primaryKeys|:{1}},
|properties|:{|linkURL|:"
http://www.beehivecollective.org", |linkNumber|:1,
|linkText|:"Beehive Design Collective"}}, {|entityName|:"Link",
|globalID|:{|entityName|:"Link", |primaryKeys|:{2}},
|properties|:{|linkURL|:"
http://www.sensoryresearch.com", |linkNumber|:2,
|linkText|:"Link #2"}}}
set firstItem to item 1 of soapResult
--> {|entityName|:"Link", |globalID|:{|entityName|:"Link",
|primaryKeys|:{1}},
|properties|:{|linkURL|:"
http://www.beehivecollective.org", |linkNumber|:1,
|linkText|:"Beehive Design Collective"}}
set itemProps to |properties| of firstItem
--> { |linkURL|:"
http://www.beehivecollective.org", |linkNumber|:1,
|linkText|:"Beehive Design Collective"
}
set theURL to |linkURL| of itemProps
--> "
http://www.beehivecollective.org"
Or, to do it in one line:
set theURL to |linkURL| of |properties| of item 1 of soapResult
Andrew
:)
On 5/11/03 8:58 PM, "Jaime Magiera" <email@hidden> wrote:
>
I'm having problems parsing a record result of a SOAP call...
>
>
1. This is the total response
>
>
{{|entityName|:"Link", |globalID|:{|entityName|:"Link",
>
|primaryKeys|:{1}},
>
|properties|:{|linkURL|:"http://www.beehivecollective.org",
>
|linkNumber|:1, |linkText|:"Beehive Design Collective"}},
>
{|entityName|:"Link", |globalID|:{|entityName|:"Link",
>
|primaryKeys|:{2}},
>
|properties|:{|linkURL|:"http://www.sensoryresearch.com",
>
|linkNumber|:2, |linkText|:"Link #2"}}}
>
>
>
2. Using
>
>
set theLink to item 1 of this_result
>
>
>
I get...
>
>
{|entityName|:"Link", |globalID|:{|entityName|:"Link",
>
|primaryKeys|:{1}},
>
|properties|:{|linkURL|:"http://www.beehivecollective.org",
>
|linkNumber|:1, |linkText|:"Beehive Design Collective"}}
>
>
>
>
3. I've tried to get at the particular parameters of this record
>
without success. Should it the code just be...
>
>
>
set theURL to linkURL of theLink
>
>
What am I missing?
>
>
Jaime
>
_______________________________________________
>
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.
_______________________________________________
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.