Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Array Problem
Message
From
21/08/2013 14:34:08
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
21/08/2013 13:01:04
Thomas Ganss (Online)
Main Trend
Frankfurt, Germany
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP3
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01580886
Message ID:
01580917
Views:
37
>While wrapping can have benefits from hooking ability, just wrapping basic language functionality is a bad idea.
>Switching your parameter order around you'd have getArrayElement(@laWarnLbl, 5), which could easily be optimised to laWarnLbl[5] ;-)

I didn't come up with the piece of code. However, I feel it valuable to show them all that was wrong with it. I expect they have a reason for needing such a piece of code, possibly to add functionality to it, rather than just laWarnLbl[5].

>
>>
>>If you have a field called lnElement in the active table, and it has a value greater than 6, you will get this error. I strongly advise you to alter this routine so that it uses LPARAMETERS. It should receive the array as a parameter too. It should declare pcTheData LOCAL or not even use pcTheData at all. I'd write it this way.
>>
>>
getArrayElement.prg
>>LPARAMETERS lnElement,taArray
>>EXTERNAL ARRAY taArray && prevents compiler error.
>>RETURN taArray[m.lnElement]
>>
>>and I'd call it like this
>>
?GetArrayElement(5,@laWarnLbl)
Previous
Reply
Map
View

Click here to load this message in the networking platform