Function return value(s)


Avgerinos
 

Hi magicians

Is there any way to return more than one values from a function?
Parameters are input-only. So far, I can only think of passing the var-index ('XX'VAR) as a parameter and use VARSET in the function to update it.
Any alternatives?

Regards
Avgerinos


Keith Canniff
 

Avgerinos,

Pass a blob and pass back and forth whatever content you want. This way you could pass an entire table in and out of a function (mtblset, mtblget), or just a simple alpha field with some delimiter that separates the values passed back.

HTH

Keith

-----Original Message-----
From: main@magicu-l.groups.io <main@magicu-l.groups.io> On Behalf Of Avgerinos
Sent: Sunday, August 12, 2018 12:13 PM
To: main@magicu-l.groups.io
Subject: [magicu-l] Function return value(s)

Hi magicians

Is there any way to return more than one values from a function?
Parameters are input-only. So far, I can only think of passing the var-index ('XX'VAR) as a parameter and use VARSET in the function to update it.
Any alternatives?

Regards
Avgerinos


Mike Bannon
 

Hi Avgerinos

If the required return values were all of the same data types, i.e. all alphas or all numerics, you could use a vector. Or you could pass back a character-separated string, such as "abc¬99¬xyz" and parse this in the calling programme using the StrToken function.

HTH
Mike Bannon
DataFormation Ltd., UK

-----Original Message-----
From: main@magicu-l.groups.io [mailto:main@magicu-l.groups.io] On Behalf Of Avgerinos
Sent: 12 August 2018 17:13
To: main@magicu-l.groups.io
Subject: [magicu-l] Function return value(s)

Hi magicians

Is there any way to return more than one values from a function?
Parameters are input-only. So far, I can only think of passing the
var-index ('XX'VAR) as a parameter and use VARSET in the function to
update it.
Any alternatives?

Regards
Avgerinos


Avgerinos
 

Thanks.
Same date-type, so a vector will do :-)

On 12/8/2018 7:34 μμ, Mike Bannon wrote:
Hi Avgerinos

If the required return values were all of the same data types, i.e. all alphas or all numerics, you could use a vector. Or you could pass back a character-separated string, such as "abc¬99¬xyz" and parse this in the calling programme using the StrToken function.

HTH
Mike Bannon
DataFormation Ltd., UK

-----Original Message-----
From: main@magicu-l.groups.io [mailto:main@magicu-l.groups.io] On Behalf Of Avgerinos
Sent: 12 August 2018 17:13
To: main@magicu-l.groups.io
Subject: [magicu-l] Function return value(s)

Hi magicians

Is there any way to return more than one values from a function?
Parameters are input-only. So far, I can only think of passing the
var-index ('XX'VAR) as a parameter and use VARSET in the function to
update it.
Any alternatives?

Regards
Avgerinos