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?
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
"There are only 10 kinds of people in this world... those who understand binary and those who don't"
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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.