accessing properties of a record

I’m probably missing something simple here, but I need to be able to refer to a property of a record as a variable

theList → contains a list of integers ranging from 0 to 2
theTeam → contains a record with the properties that are the same as the values for “theKey” in the statsDisplayKeys

property statsDisplayKeys : {{theKey:"conference", theTitle:"Conf"}, {theKey:"division", theTitle:"Div"}, {theKey:"displayWinsLosses", theTitle:"Rec"}, {theKey:"winPercent", theTitle:"Win%"}, {theKey:"homeRoadRecord", theTitle:"H/R Rec"}, {theKey:"displayConWinsLosses", theTitle:"C Rec"}, {theKey:"displayNonConWinsLosses", theTitle:"NC Rec"}, {theKey:"displayDivWinsLosses", theTitle:"D Rec"}, {theKey:"displayLast5WinsLosses", theTitle:"Last 5"}, {theKey:"winStreak", theTitle:"Streak"}, {theKey:"netPoints", theTitle:"Net Pts"}, {theKey:"touchDowns", theTitle:"TDs"}, {theKey:"off3rdDownsPercent", theTitle:"Off 3rd %"}, {theKey:"off4thDownsPercent", theTitle:"Off 4th %"}, {theKey:"turnOvers", theTitle:"TOs"}, {theKey:"def3rdDownsPercent", theTitle:"Def 3rd %"}, {theKey:"def4thDownsPercent", theTitle:"Def 4th %"}}

.
.
.

repeat with x from 1 to count of theList
	if theList's item x = 2 as integer then -- add to stats text
		set currentKey to statsDisplayKeys's item x's theKey -- this is the line that is giving me trouble
		set currentStat to theTeam's currentKey
		.
		.
		.
	end if
end repeat

Thanks in advance,
Brad

AS doesn’t let you make a property name from a string. There are various hacks for doing it, including using run script. But the best advice is usually to find another way.

Thanks for the info. I did find another way…an ugly series of “if…then…else” statements.

Thanks,
Brad