What happens if just before the class.unload you delete the vdata vector, then
do a win.debug(myviewstruct.numobjects)
>
> local rec = myviewstruct.new()
> for each word myword index j in myviewstruct.variables
> local myvarname="rec."++myword
> do("&(myvarname) = MyView.Fields(j).Value")
> endfor
> vData[i]=rec
> MyView.MoveNext
> endfor
> quit(vdata)
I think you could get rid of myvarname and "rec." stuff by assigning directly
by doing
vdata[i] = myviewstruct.new()
...
do ("vdata[i]."++myword" = MyView.Fields(j).Value")
(But not tested, so may break).
This may help with the flaky reference counter since there is no intermediate
variable rec which has it's own reference to the object (however, what you
wrote should work if there are no bugs in PowerPro).
Lastly, what you did is pretty advanced in that the script works for any
database table. I suspect if anyone did this for a real example, they would
know the table they wanted to work with in advance and hardcode the names of
the column table into the program, especially since often only a few columns
from the table would actually be needed.