My apologies! I re-read your message and realized that when I read it the first time I mistakenly thought that you were proposing assigning the data to PUBLICs, but that was Lailton's code that you had quoted.
Your code is in fact a good example of how to get data out of an array with minimal code. It could be used in my proposed getEvent() method.
- Code: Select all Expand view
- Method getEvent( cEvent )
local aX
cEvent:= upper(alltrim(cEvent))
FOR EACH aX IN ::aEvents
IF aX[2] == cEvent
uValue:= aX[2]
ENDIF
NEXT
return uValue
I don't know if there is an advantage over using FOR TO, but perhaps it is faster and at the least it is slightly less code. I always like to see alternative solutions too.
So, thanks for posting it, and again my apologies for making my previous comments about it. I guess I need more sleep...
Regards,
James