Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy contents of array to a table 3

Status
Not open for further replies.

choppysuey

Technical User
Mar 28, 2001
54
US
Hi everyone, in VFP 6.0 is there a built in function that will copy the contents of an array to a table? If not what is a clean way to do it besides writing code to create a table and then walking the array.

Thanks.
-suey
 
How about a copying the contents of an array to a comma delimited file? Any built in functions for that in VFP6?
 

After you APPENDed FROM ARRAY into the cursor, you can use COPY TO ... DELIMITED ... command.
 
I used an array to hold multiple calculated values and wanted to take the contents of that array and dump it into an excel file. So I ended up creating a cursor and dumping contents of array into that and then taking the contents of the cursor into excel. Is there a better/cleaner/faster soluntion that this?

-suey
 
Thanks for the input Mike. The reason that I had to do it the way I did was that I wanted to do something like this with a query on the orig. table:

select avg(col_1) as avgCol1 for col_1 <> 0,;
avg(col_2) as avgCol2 for col_1 <> 0;
from mytable group by date

For each day, I wanted an average on each column. VFP6 didn't like it and I am no query expert so I took the long way around.

-suey
 
Mike that is some good stuff there. Thanks a lot! It totally eliminated all the extras.

Thanks,
-suey
 
Code:
iif(col_1<>0,col_1,0)
Good joke, Mike :). It's not wrong, but rather useless, isn't it?

If its unequal to 0, then sum it, if not, then sum 0.

Code:
select ;
  sum(col_1) / sum(iif(col_1<>0,1,0)) as avgCol1, ;
  sum(col_2) / sum(iif(col_2<>0,1,0)) as avgCol2

Unfortunately there is no such thing as count(col_1#0).

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top