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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Monthly averages to a new table

Status
Not open for further replies.

bigandfat

Technical User
Feb 7, 2002
42
0
0
CA
I have been asked to set up a table of monthly averages such as generated by a report. I am unsure of the syntax to use to generate this in object pal so it can be done automatically. Does anyone have any recomendations?

Thanks in advance
 
I you need to maintain the data, then I would run a query using the CALC AVERAGE AS <FIELDNAME> operator in the fields that you need. Then you could use a tCursor to add the values into an averages table.

If you don't need to maintain the data in a table, then you can query by date range then output to a report using an AVG summary field for each of the fields you want averaged.



Mac :)

&quot;There are only 10 kinds of people in this world... those who understand binary and those who don't&quot;

langley_mckelvy@cd4.co.harris.tx.us
 
bigandfat,

I would probably go the query route myself, primarily because there's a variant of the executeQBE() and the executeSQL() methods that sends results to a tCursor.

One you have the averages in a tCursor, you can use the instantiateView() method to create a table containing those results. Be aware that the tCursor variable then points to the new table, not the original query results.

(I mention this because you can use instantiateView() to create copies of any tCursor data, not just ones populated with query results.)

If you'd like to see an example of instantiateView(), check out and ( both use the method to create copies of data in tCursors.

Hope this helps...

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top