Hello.
I am trying to create a report of Contacts grouped by Account Name, but it doesn’t work. I have created a Report with module Contact, added Account Name, First Name and Last Name fields, and set the “Main Group” to “Account Name”. But the report appears as if no Main Group was specified.
However, if I change the “Main Group” to “First Name”, the report displays as I would expect.
Digging through the code, I think the problem is in the build_group_report() method of AOR_Report. Teh query it generates is
SELECT `contacts`.account_id AS 'Business_Name' FROM contacts WHERE ( `contacts`.account_id IS NOT NULL AND contacts.deleted = 0 ) GROUP BY `contacts`.account_id ORDER BY Business_Name ASC
This fails because there is no “account_id” field in Contact, because the relationship between Contact and Account is many-to-many.
Does anyone know if there is a work-around for this?
Regards,
Carl