I have an array defined as a public variable

public gaPos

I can happily populate the array but when I reference it in a form's
method the I get a compilation error - Unable to find Unknown gaPos

The code is as follows:

li = ALEN(gaPos, 1)
i = 0

lcValue = gaPos(1)

the variable li contains the correct number of elements in the array but
the lcValue = gaPos(1) line generates the above compile error.

other none array Public variables seem fine in the method.

What have I missed?


thanks

pete

Re: Public array variable "lost" by Rush

Rush
Sun Dec 16 19:58:17 PST 2007

Peter Huish wrote:
> I have an array defined as a public variable
>
> public gaPos
>
> I can happily populate the array but when I reference it in a form's
> method the I get a compilation error - Unable to find Unknown gaPos
>
> The code is as follows:
>
> li = ALEN(gaPos, 1)
> i = 0
>
> lcValue = gaPos(1)
>
> the variable li contains the correct number of elements in the array but
> the lcValue = gaPos(1) line generates the above compile error.
>
> other none array Public variables seem fine in the method.
>
> What have I missed?
>
>
> thanks
>
> pete
>
Try using the square bracket syntax:

lcValue = gaPos[1]

The compiler doesn't know that gaPos is an array - it looks like a
function call, and is not found.

(At least, that's my guess).

- Rush

Re: Public array variable "lost" by Bernhard

Bernhard
Mon Dec 17 04:55:25 CST 2007

Hi Peter,

> I have an array defined as a public variable
>
> public gaPos
>
> I can happily populate the array but when I reference it in a form's
> method the I get a compilation error - Unable to find Unknown gaPos
>
> The code is as follows:
>
> li = ALEN(gaPos, 1)
> i = 0
>
> lcValue = gaPos(1)
>
> the variable li contains the correct number of elements in the array but
> the lcValue = gaPos(1) line generates the above compile error.
>
> other none array Public variables seem fine in the method.
Do you get the error during compiling your form or when you build the project?

In the latter case, just add a line
EXTERNAL ARRAY gaPos
to every method or program file, where you use this array.

Regards
Bernhard Sander

RE: Public array variable "lost" by Mark

Mark
Mon Dec 17 10:10:01 CST 2007

Hi Peter,
Define your public array like

Public Array gaPos[1]

hth

Mark

"Peter Huish" wrote:

>
> I have an array defined as a public variable
>
> public gaPos
>
> I can happily populate the array but when I reference it in a form's
> method the I get a compilation error - Unable to find Unknown gaPos
>
> The code is as follows:
>
> li = ALEN(gaPos, 1)
> i = 0
>
> lcValue = gaPos(1)
>
> the variable li contains the correct number of elements in the array but
> the lcValue = gaPos(1) line generates the above compile error.
>
> other none array Public variables seem fine in the method.
>
> What have I missed?
>
>
> thanks
>
> pete
>

Re: Public array variable "lost" by Gene

Gene
Mon Dec 17 10:24:52 CST 2007

Rush Strong <rpstrong@gmail.com> wrote:

[snip]

>Try using the square bracket syntax:
>
> lcValue = gaPos[1]
>
>The compiler doesn't know that gaPos is an array - it looks like a
>function call, and is not found.
>
>(At least, that's my guess).

It is incorrect. Try
? sqrt[2]
It will print the square root of 2. It is not an array reference. For
real fun, try
? sqrt[2)
VFP will throw the error "Function name is missing )."!

Sincerely,

Gene Wirchenko


>
> - Rush

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

RE: Public array variable "lost" by Peter

Peter
Mon Dec 17 21:23:06 CST 2007


> Define your public array like
>
> Public Array gaPos[1]

this seems to have fixed the problem.

What I don't understand is why this is the only array affected ...


thanks all for your help.


pete