CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • unable to create report from a template
Pages: [1]

Author Topic: unable to create report from a template  (Read 2533 times)

Aahar

  • I post occasionally
  • **
  • Posts: 79
  • Karma: 3
  • CiviCRM version: 3.4 and 4.0
  • CMS version: Drupal 6.17, 6.x and Drupal 7.x
  • PHP version: 5.2
unable to create report from a template
February 22, 2013, 09:13:59 am
I have made a custom report. Works fine as a Template.
But when I proceed to "Create Report" it returns
    Report "" has been created and is now available in the report listings under "Contact" Reports.
Notice that the report name is empty. The report is not listed under the "Contact" as well.

Even "Print Preview", "Preview PDF", "Preview CSV" or clicking the print icon returns backs to the same page without making a preview or print page.

Drupal version: 7.8
Civicrm version: 4.0.7

Aahar

  • I post occasionally
  • **
  • Posts: 79
  • Karma: 3
  • CiviCRM version: 3.4 and 4.0
  • CMS version: Drupal 6.17, 6.x and Drupal 7.x
  • PHP version: 5.2
Re: unable to create report from a template
February 22, 2013, 09:56:03 am
Got it.

I missed "         $this->beginPostProcess( );" in

   function postProcess( ) {
            
         $this->beginPostProcess( );

Mark Tompsett

  • I post frequently
  • ***
  • Posts: 143
  • Karma: 9
    • QualityTime Services Ltd
  • CiviCRM version: 4.3.4
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.30-cll
  • PHP version: 5.3.23
Re: unable to create report from a template
May 22, 2013, 04:06:05 am
I have the same problem, but this didn't fix it.

Here is my report template
Code: [Select]
<?php
 
class CRM_Report_Form_Contact_Myreport extends CRM_Report_Form {
    function 
postProcess( ) {
        
$this->beginPostProcess( );
 
        
// note1: your query
        
$myQuery = "SELECT * FROM `v_primary_address` ";
 
        
// note2: register columns you want displayed-
        
$this->_columnHeaders = array( 
                 
'contact_id' => array(  ),
                 
'street_address'  => array( 'title' => 'street_address ' ),
                 
'supplemental_address_1'  => array( 'title' => 'supplemental_address_1 ' ),
                 
'supplemental_address_2'  => array( 'title' => 'supplemental_address_2 ' ),
                 
'city'  => array( 'title' => 'city ' ),
                 
'postal_code'  => array( 'title' => 'postal_code ' ),
                 
'country'  => array( 'title' => 'country' ),
 
 );
        
// note3: let report do the fetching of records for you
        
$this->buildRows ( $myQuery, $rows );
 
        
$this->formatDisplay($rows);
 
        
$this->doTemplateAssignment( $rows );
        
$this->endPostProcess( $rows );
     
     } 
// post process ends
 
} // class ends

In case you need to reproduce it, here is the definition of the view v_primary_address
Code: [Select]
CREATE ALGORITHM = UNDEFINED VIEW `v_primary_address` AS
SELECT contact_id, street_address, supplemental_address_1, supplemental_address_2, city, postal_code, ctry.name AS country
FROM civicrm_address
LEFT JOIN civicrm_country ctry ON country_id = ctry.id
WHERE is_primary =1

I can create a template for it.. (see screenshot3), and I can preview the report (which looks fine), but when I try to create a report instance from it I get
Quote
"" report has been successfully created

When I check the details of the report instance in the database (using phpMyAdmin) I see that all of the fields are NULL except for those visible in screenshot2.

What am I doing wrong?
What else can I do to diagnose the problem?

I am using CiviCRM 4.3.3 with Drupal 7.22.

Mark
« Last Edit: May 22, 2013, 04:08:31 am by Mark Tompsett »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • unable to create report from a template

This forum was archived on 2017-11-26.