Re: Accessing a Record by variable
Re: Accessing a Record by variable
- Subject: Re: Accessing a Record by variable
- From: Ken Dobson <email@hidden>
- Date: Tue, 13 Feb 2001 22:13:48 -0500
>
>> on 2/12/01 8:02 PM, Douglas Wagner at email@hidden wrote:
>
>
>>> set aMth to "Feb"
>
>>> set theMths to {Jan:"1", Feb:"2", Mar:"3", Apr:"4", May:"5", Jun:"6",
>
..
>
>>> set mthNum to aMth in theMths
>
>
>>> what I'd like to get is --> 2
>
>
>>> I'm astonished this doesn't work.
This works for the current problem (can be found in the AS Guidebook)
--
set aMth to "Sept"
set theMths to {"Jan", "Feb", "March", "Apr", "May", "June", "July", "Aug",
"Sept", "Oct", "Nov", "Dec"}
set mthNum to list_position(aMth, theMths)
--> 9
--
on list_position(x, this_list)
repeat with i from 1 to (count of this_list)
if item i of this_list is x then return i
end repeat
end list_position