Hi Koen

I still have lots of arrays in my code, which I start getting rid off. I thought you gave a way to avoid the multiple testings necessary when working with arrays. I checked what you wrote and found that it does not work

> … Tony wants to know if an array exists and is therefore applying the command dimension…

If you don’t declare them, the results with alen() are still the same, or even worse: you get an error if the array was not created.

> … and you come with lots of arguments about a 2-diomensional array…

These are 1 dimentional arrays. I added the 2-dim arrays for further testing.

DIMENSION aArr[1]
?ALEN(aArr) && returns 1
?
DIMENSION aArr[1]
aArr[1]="A" && -> element has a value set.
?ALEN(aArr) && returns 1

> What is your point here?

My point was I just couldn’t figure out how you can use ALEN() for such checking. It was not my intention to criticize you. An example of how you do it with ALEN() would help…

> > What does that mean, Koen?

> > How can you make the difference with ALEN()? It returns same values if an element "exists" (has a value set) or not.

> >

> >

> > CLEAR
> > DIMENSION aArr[1]
> > ?ALEN(aArr) && returns 1
> > ?ALEN(aArr,1) && returns 1
> > ?ALEN(aArr,2) && returns 0
> > RELEASE aArr
> > ?
> > DIMENSION aArr[1]
> > aArr[1]="A" && -> element has a value set.
> > ?ALEN(aArr) && returns 1
> > ?ALEN(aArr,1) && returns 1
> > ?ALEN(aArr,2) && returns 0
> > RELEASE aArr
> > ?
> > * Multi col
> > DIMENSION aArr[1,1]
> > ?ALEN(aArr) && returns 1
> > ?ALEN(aArr,1) && returns 1
> > ?ALEN(aArr,2) && returns 1
> > RELEASE aArr
> > ?
> > DIMENSION aArr[1,1]
> > aArr[1,1]="A" && -> element has a value set.
> > ?ALEN(aArr) && returns 1
> > ?ALEN(aArr,1) && returns 1
> > ?ALEN(aArr,2) && returns 1
> > RELEASE aArr
> >

> >

> >

> > Regards

> > Samir

>

>

>

> Samir,

>

> Maybe I dont understand. But mu understanding of < if something exists> is that something is there and not what something contains, and if something contains something it is there, but again maybe I am wrong.

>

> Please consider Tony wants to know if an array exists and is therefore applying the command dimension, that is in my opinion wrong.

> with dimension you give a dimension to an array.

> with alen() you can check the length of an array.

> I pointed that in the help file you can check quote

*If the array is a one-dimensional array, ALEN( ) returns 0 (no columns)*.unquote and you come with lots of arguments about a 2-diomensional array.

> What is your point here?

> Furthermore it is not my habit to react in this way but Tony was, lets say it nicely, telling us VFP is a lousy language without again, saying it nicely, not nowing the least of the language judging his questions.

>

> Regards,

>

> Koen

Regards

Samir