General information
Category:
Coding, syntax & commands
Title:
Passing array by reference from ASP to VFP COM Object
I have tried to develop an implementation of a sort function in a VFP COM object, but I can't seem to be able to pass the array by reference.
I don't know if the error is in my VFP code or my ASP code.
Most of you probably don't deal with ASP, but you coud probably help me out with the VFP side...
Here is what I use as code for the COM component:
*********************************************************************
DEFINE CLASS COMTools AS Relation OLEPUBLIC
FUNCTION Init
SET UDFPARMS TO REFERENCE
ENDFUNC
FUNCTION BubbleSort
PARAMETERS laArrayName, lnLength, lnSize, lnElement, lnSortType
LOCAL i, j, laTemp, lnArrayElements
IF PARAMETERS() = 5 THEN
DECLARE laTemp[1, lnSize]
FOR i = 1 to lnLength
FOR j = (i) to lnLength
IF IIF(lnSortType = 2, laArrayName[j, lnElement] < laArrayName[i, lnElement], laArrayName[j, lnElement] > laArrayName[i, lnElement]) THEN
FOR lnArrayElements = 1 to lnSize
laTemp[1, lnArrayElements] = laArrayName[i, lnArrayElements]
ENDFOR
FOR lnArrayElements = 1 to lnSize
laArrayName[i, lnArrayElements] = laArrayName[j, lnArrayElements]
ENDFOR
FOR lnArrayElements = 1 to lnSize
laArrayName[j, lnArrayElements] = laTemp[1, , lnArrayElements]
ENDFOR
ENDIF
ENDFOR
ENDFOR
cTemp = ALLTRIM('')
FOR lnArrayElements = 1 to lnLength
cTemp = cTemp + '|' + STR(laArrayName[lnArrayElements, 1])
ENDFOR
RETURN cTemp
ELSE
RETURN .F.
ENDIF
ENDFUNC
ENDDEFINE
*********************************************************************
So I do set my parameters to be passed by reference, but I am not sure that this means that they are received by reference.
Is there a way to make VFP get a variable by reference, or is this only a problem on the ASP client?
If any of you know how to pass a variable by reference in ASP (Basically VBScript), please let me know.
Thanks in advance.
Etienne Paquin.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only