Individual Group MembershipThe following short tutorial/example demonstrates adding a custom report to CiviReport. This is based on the tutorial given here: CiviReport structure and customization Columns for DisplayFirst, work out which columns you want displayed on resulting report. In this case these are:
How should the columns be sorted?Next, to help build the SQL, decide which columns should be sorted alphabetically. In this case:
Sort by Organisation Name first, then by Sort Name for Individual, and finally, Group Build the SQLUsing phpMyAdmin (or your tool of choice) build and test the SQL to return the above criteria: Create the Report File(s)Rather than creating a custom directory structure, I placed the required php and tpl files in the same place as the CiviCRM files (this is backed up periodically anyways) In <civicrm_root>/CRM/Report/Form/Contact, I created ContactClinics.php containing the following: In <civicrm_root>/templates/CRM/Report/Form/Contact, I created ContactClinics.tpl containing the following: Add the report and PreviewUsing Administer, CiviReport, Register new template with the following:
Using Report, Manage Templates; select the new 'Contact Clinics' template and preview Considerations
|
Labels