Hi all

This is in reaction (response is perhaps not quite the right term) to solving the problem of returning an array from a form without the use of custom objects. It should work from anywhere (including calling the form from the command window). Reading previous threads (which have often digressed and talked about OO approaches when a non-OO solution was being sought), did not clarify the issue for me and it does not appear to be as simple as whether the array is passed by reference or not. So here is what *works*. It also demonstrates how to return more than one value from a form.

In command window (or anywhere else)

DIME myArray(1) && myArray (see below) MUST be an array if you want an array returned
MyVar = "" && Can be any data type you like

DO FORM frmMyForm WITH "myArray","MyVar"   && second parameter is optional

frmMyForm.Init   && frmMyForm has properties cParam1 and cParam2

PARAMETERS tcArrayName, tcParam2

THIS.cParam1 = tcArrayName
THIS.cParam2 = tcParam2

frmMyForm.Unload

*- The next line is where it is important that the value passed as a parameter ("myArray") represents an existing array ACOPY(THIS.aFiles,(THIS.cParam1)) && Example only - Unload method could create a local array and ACOPY that instead

*- In the next line it is *not* critical that the value stored to the variable is of the same type as stored in the original variable
STORE "This is a test" TO (THIS.cParam2)
*- STORE 9 TO (THIS.cParam2)
*- STORE DATE() TO (THIS.cParam2)

RETURN


HTH somebody in the future

Comments welcome





_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to