> > > > > Hi,
> > > > >
> > > > > This maybe a stupid question, but my brain is fried today.
> > > > >
> > > > > I have a simple cursor open with my record pointer pointing on
> > > > > a record. This cursor was make from a SQLEXEC() call to a SQL-Server
> > > > > backend.
> > > > >
> > > > > I am kicking myself as there is probably a simple way to do this.
> > > > > I want to create a 2 dimensional array, where the first component is
> > > > > the field names, and the second conponent is the actual values in the
> > > > > field.
> > > > >
> > > > > Anyone got any ideas, as I am fresh out.
> > > > >
> > > > > Pete from the Great White North. (Only in Canada, ay.) Over and Out ...
> > > >
> > > > FOR i = 1 TO FCOUNT()
> > > > DIMENSION aCursor[i,2]
> > > > aCursor[i,1] = FIELD(i)
> > > > aCursor[i,2] = EVALUATE(FIELD(i))
> > > > ENDFOR
> > > >
> > > >
> > > > -BP
> > > > www.peisch.com
> > >
> > >
> > > Hi Barbara,
> > > Yeppers that does it.
> > > Ken's solution works as well, but your code is tighter.
> > > Pete from the Great White North. (Only in Canada, ay.) Over and Out ...
> >
> > Actually, both mine and Ken's code are pretty much the same. He specified the alias and I didn't. But he also had only one dimension statement before the loop, which I think is better.
> >
> > -BP
> > www.peisch.com
>
>
> Hi,
> I ponder at the location of the dimension statement?
> The statement inside the loop seems only to add the the
> array, rather than recreating it over and over again.
> Mechanically, I am not 100% as to what is really happening?
>
> Pete from the Great White North. (Only in Canada, ay.) Over and Out ... Pete,
I think you are correct - it only adds to the array. Mine is probably a throwback to the days when dinosaurs roamed the earth and you had to declare the array size before you could use it. I never fell out of that habit.
As to the alias, I tend to like to explicitly add the alias - it is far less dangerous, especially with a command like ZAP.
Ken
You shall know the truth - and the truth shall set you free. (John 8:33)