Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP equivalent of Clipper's Aadd() function?
Message
From
18/05/1998 03:41:16
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00100035
Message ID:
00100049
Views:
66
>I'm converting a Clipper app to VFP and there are many occurances of the Aadd() function. I'd like to write my own Aadd() to mimic Clipper's, if possible without changing the function calls at all.
>
>Here's an example of the Clipper calls...
>
>
>AAdd( aSortInfo, { IDOCOMP.SORTREF1, IDOCOMP.SORTNAME1, IDOCOMP.FLREF } )
>
>
>AAdd( aKeys, IDALTF.ELREF )
>
>Remember, I'd like to leave these calls unchanged...
>
>TIA
>
>Larry

It shouldn't be too hard, as long as you aren't trying to implement sparse arrays. ALEN() can be used to determine the current size of the array (get the # rows, # cols), use DIMENSION to redimension the array to add a row (this will create a row filled with logical .F. as the last row of the array, and then for each column in the array, replace the equivalent column of the last row with the parameter corresponding to the position. The arrray must be passed by reference explicitly. A brain-dead simpl example:


FUNCTION AddAnArrayRow
lparameter taarray, tuarg1, tuarg2, tuarg3, tuarg4
local ncol, nrow
ncol = ALEN(taarray,2)
nrow = alen(taarray,1)
dimension taarray[nrow+1, ncol]
local nCtr
FOR nCtr = MIN(ncol,4)
taarray[nrow+1,nCtr] = EVAL('tuarg'+str(cNtr,1))
ENDFOR
RETURN .t.

DIMENSION myArray[1,2]
MyArray[1,1] = 'First'
MyArray[1,2] = 'Second'
=AddAnArrayRow(@MyArray,3,'Four')
=AddAnArrayRow(@MyArray,'Five',6.000)
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform