>Hello!
>
>I have a Problem Programming a variable Array handling Program.
>Here is the Problem:
>
>Dimension a(2)
>a(1)="Hello"
>a(2)="I am Marvin"
>
>?a(1,1) -> Delivers "Hello"
>?a(2,1) -> Delivers "Hello" ... this really brings me to confusion
>
>?alen(a,1) -> delivers 1 ...WHY??? Why not 2
>
>So I work around my Problem with alen(a,2).
>Now I decide to let my Array be 2 Dimensional. Great so long...
>
>Dimension a(2,3)
>a(1,1)="Hello"
>a(1,2)="C"
>a(1,3)=1
>
>a(2,1)="I am Marvin"
>a(2,2)="A"
>a(2,3)=2
>
>?alen(a,2) -> delivers 3 ... which is not the Value I'd like to work with.
>So I use the :
>?alen(a,1) -> delivers 2 ... juhu
>
>This lets me decide to use the Multi Dimensional Array like this
>Dimension a(2,3)
>a(1,1)="Hello"
>a(2,1)="C"
>a(3,1)=1
>
>a(1,2)="I am Marvin"
>a(2,2)="A"
>a(3,2)=2
>
>But.. how do I delete a complete element...
>ok with adel(a,2,2)
>Now I'd like to have a look with the Debugger... no chance to get the correct Display.
>
>Why does the Afields(a) command show me the incorrect way?
>Many questions, but no solution. All I know is that this behaviour is more than confusing to me.
>Just wanted to let out my confusion.... *ggg*
First, single letter variables shouldn't be used because it can confuse VFP. "A" or "a" also is a reference to a workarea.
Second, with the two dimensional array, using the 1 parameter returns the number of rows, and the 2 paramter returns the number of columns. Try the following
DIMENSION myarray[2]
myarray[1] = 'Hello'
myarray[2] = 'George'
? myarray[1]
? myarray[2]
? ALEN(myarray, 1)
? ALEN(myarray)
? ALEN(myarray, 2)
DIMENSION myarray[2, 2]
myarray[1, 1] = 'Hello'
myarray[1, 2] = 'Hello Again'
myarray[2, 1] = 'George'
myarray[2, 1] = 'George Again'
? myarray[1, 1]
? myarray[1, 2]
? myarray[2]
? myarray[2, 1]
? myarray[2, 2]
? myarray[4]
? ALEN(myarray, 1)
? ALEN(myarray)
? ALEN(myarray, 2)
hth,
George
Ubi caritas et amor, deus ibi est