Monday, March 19, 2012

[Solved] Kinamu Reporter 'Invalid argument supplied' Problem

You might have seen the below error in Kinamu Reporter:
Warning: Invalid argument supplied for foreach() in \modules\KReports\KReportQuery.php on line 401
Warning: reset() expects parameter 1 to be array, null given in \modules\KReports\KReportQuery.php on line 784
Warning: Invalid argument supplied for foreach() in \modules\KReports\KReportQuery.php on line 785

This problem comes when you have not added any field in the selection criteria.
While creating report, on the right panel under Report Definition, you can see 2 things: Selectioncriteria and Display Fields. Problem occurs when you add fields only in Display Field but not in Selectioncriteria.

Let us suppose that you added first name and last name from module contacts in Display Fields, then the query will be:
select first name, last name from contacts

This statement should work but in basic version of Kinamu Reporter, this statement alone does not work. So you need to specify parameters in Selectioncriteria also. Adding parameters in Selectioncriteria means that you are specifying where clause for the query statement. For e.g. if you set first_name = 'Poonam' in Selectioncriteria, then the query will be:
select first name, last name from contacts where first_name = 'Poonam'

This solves the problem.

No comments:

Post a Comment