Ticket #296 (new New feature)

Opened 4 months ago

Last modified 1 month ago

Add feature "operation=sum" to sum data from several periods in the API request

Reported by: mauser Assigned to:
Priority: major Milestone: Stable release
Component: Core Version:
Keywords: Cc:

Description (Last modified by matt)

We need to get the sum of statistics data from the "beginning" which means from the moment we added site to the system (ts_created field in site table).

It can be very useful for example in video plugin when we can get the sum of all video events (i.e. video_play) from the first time video appeared online. It is quite important feature.

To do what you want to do, the best thing I can think of is to build a filter that would sum up the DataTable_Array of every year and output only the sum.this could look like:

?module=API&method=VisitFrequency.getVisitsReturning&idSite=1&period=year&date=last10&format=xml
&operation=sum

This filter could use the DataTable::addDataTable The only thing to think of is that the DataTable_array could be simple:

 date=A
    data A
 date=B
    data B

looping over the set and sum the datatable should work.

For the version where the rows are themselves made of dataTable_Array

idsite=1
 date=A
    data A
 date=B
    data B
idsite=2
 date=A
    data C
 date=B
    data D
 etc.

we want the output

idsite=1
  data A+B
idsite=2
  data B+D

Change History

07/10/08 00:55:12 changed by mauser

  • description changed.

10/10/08 15:12:30 changed by matt

  • milestone changed from DigitalVibes to Stable release.

10/10/08 16:41:22 changed by matt

  • description changed.
  • summary changed from Summing data from last 10 years to Add feature "operation=sum" to sum data from several periods in the API request.