@tsteur opened this issue on November 11th 2012

Hi,

In Piwik Mobile I'm trying to open a graph within Search Engine Subtable and I get a fatal error. Almost all subtable evolution graphs are working except Search Engines. I'm not sure if other fail too.

Fatal error: Call to undefined method Piwik_DataTable_Array::getRowFromIdSubDataTable() in /home/piwik/www/demo.piwik.org/plugins/Referers/API.php on line 156

Graph URL:

http://demo.piwik.org/index.php?module=API&method=ImageGraph.get&idSite=7&apiModule=Referers&apiAction=getKeywordsFromSearchEngineId&token_auth=anonymous&period=year&date=2003-01-01,2012-12-31&idSubtable=1491&filter_sort_column=nb_visits&column=nb_visits&columns=nb_visits&token_auth=anonymous&idSite=7&language=en&

The ImageGraphEvolutionUrl is generated here:

http://demo.piwik.org/index.php?idSite=7&date=today&hideMetricsDoc=1&filter_sort_column=nb_visits&apiModule=Referers&apiAction=getKeywordsFromSearchEngineId&period=year&idSubtable=1490&filter_limit=30&module=API&token_auth=anonymous&format=json&method=API.getProcessedReport&language=en&

If you access the API directly you get the same error :

http://demo.piwik.org/index.php?module=API&method=Referers.getKeywordsFromSearchEngineId&idSite=7&token_auth=anonymous&period=year&date=2003-01-01,2012-12-31&idSubtable=1491

It should be possible to query this API with period=year&date=2003-01-01,2012-12-31 because it works for other reports such as getKeywords :

http://demo.piwik.org/index.php?module=API&method=Referers.getKeywords&idSite=7&token_auth=anonymous&period=year&date=2003-01-01,2012-12-31

@sgiehl commented on April 6th 2013

The method getKeywordsFromSearchEngineId doesn't handle datatable arrays correct. I'll fix that. Btw. calling this method that way doesn't make that much sense as the method only returns the requested subtable which means all other periods will stay empty.

@sgiehl commented on April 6th 2013

In e043f906931fc79e2ea18e05a0e3efc1519549f6: fixes #3533 fixed fatal. api couldn't handle datatable arrays

@mattab commented on April 7th 2013

Stefan can you revert please?

-> It does not work, by design, to call &idSubtable and also request multiple periods. the idSubtable is the id of the row in that particular archive, and wont work across dates.

Thomas, can you check if the other reports work? I would expect them not to work for sub-tables using the &idSubtable...

To fix this, proposal: - the graphs URL use &label=Google to plot all Keywords from google, or &label=Type to plot all custom variable values for the custom var called "Type" (would plot "Admin", "Reader", "Anon", "member") - instead of using &idSubtable= (current)

It will then work across archives/dates. It requires some code changes as I just tried and it does not work yet to set &label instead of &idSubtable.

@sgiehl commented on April 7th 2013

I wouldn't revert the change as it fixes a possible fatal which shouldn't occur - even if the call can't return any usefull data.

@tsteur commented on April 7th 2013

Looks like graphs from other reports are not working either.

I think it is only a problem when period!=range? Or also when period=range?

BTW: Not only graph URLs are using "&idSubtable" + date range. Also a normal report is using &idSubtable since it is possible to select any date range for any subtable in Piwik Mobile. Period is "range" in this case and this seems to work fine.

@mattab commented on April 8th 2013

+1 for fixing the fatal error, maybe throwing an exception eg. "Unsupported parameter combination; try removing &idSubtable= or change the $date parameter" or similar message

@mattab commented on April 8th 2013

Replying to tsteur:

I think it is only a problem when period!=range? Or also when period=range? BTW: Not only graph URLs are using "&idSubtable" + date range. Also a normal report is using &idSubtable since it is possible to select any date range for any subtable in Piwik Mobile. Period is "range" in this case and this seems to work fine.

do you mean the graph generates? can you send me the URL of a graph generating with &idSubtable value? I would expect it not to work in all cases...

@tsteur commented on April 8th 2013

http://demo.piwik.org/index.php?idSite=7&date=2013-04-1,2013-04-8&hideMetricsDoc=1&filter_sort_column=nb_visits&apiModule=Referers&apiAction=getKeywordsFromSearchEngineId&period=range&idSubtable=7&filter_limit=30&module=API&token_auth=anonymous&format=json&method=API.getProcessedReport&language=en

http://demo.piwik.org/index.php?module=API&method=ImageGraph.get&idSite=7&apiModule=Referers&apiAction=getKeywordsFromSearchEngineId&token_auth=anonymous&period=range&date=2013-04-1,2013-04-8&idSubtable=7&filter_sort_column=nb_visits&column=nb_visits&columns=nb_visits&token_auth=anonymous&idSite=7&language=en

@mattab commented on February 1st 2014

This looks fixed

This issue was closed on February 1st 2014
Powered by GitHub Issue Mirror