Loop through Multi-Dimensional Array

Andrew Kluthe andrew at rjdfarm.com
Mon Jun 21 11:45:42 CDT 2010

Hey there,

I have a multi-dimensional array that uses numbers as the first element and
a string as the second.

Like this:


What I need to do is loop through each number element and then loop through
each string element. If the data in the String Element equals the Data in my
pName Paramater, I need to replace the data in the array with the parameter

The numbered loop isnt a problem as I use with x=1, but how do I nest a loop

This is the jist of what I have been doing, but I cannot get the newName to
replace the old in the array. I think its an issue of referencing the switch

function CheckRecords pName, pNewName

repeat with x=1 to the number of elements in tleaseData

repeat for each element i in tleaseData[x]
       if i is pName then
            -- The Loop Enters Here Just Fine Where It Should --
            put pNewName into i
            -- It does not do this ^^^
            put true into tleaseData[x]["Changed"] 
            -- It does this ^^^
       end if
end repeat

end repeat
end CheckRecords

Why isn't i becoming pNewName? Am I referencing that put correctly? Am I
supposed to be putting into i?
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Loop-through-Multi-Dimensional-Array-tp2262924p2262924.html
Sent from the Revolution - User mailing list archive at Nabble.com.

More information about the use-livecode mailing list