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) »
  • No row data when writing a simple custom report type
Pages: [1]

Author Topic: No row data when writing a simple custom report type  (Read 977 times)

matth

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 3.4
  • CMS version: Drupal 6
  • MySQL version: 5
  • PHP version: 5
No row data when writing a simple custom report type
June 30, 2011, 01:29:02 pm
I'm trying to learn how to create a simple custom report type, but I can't figure out how to structure queries correctly. I created a basic SELECT statement, but the $rows are all empty arrays.

I'm not entirely sure what the
Code: [Select]
_columns variable is supposed to do, or if/how it affects what displays. Is there a way to bypass some or all of the structure? I simply want to list the results of a query.

Snipped of my query:
Code: [Select]
    function select( ) {
        $this->_select = "SELECT id, display_name";
    }

    function from( ) {
        $this->_from = "
        FROM civicrm_contact
        ";
    }

    function where( ) {       
        $this->_where = "WHERE id IN (1,2,3,4,5,6)";
    }



Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Re: No row data when writing a simple custom report type
July 06, 2011, 10:45:19 pm
Hi,

Please refer this doc http://wiki.civicrm.org/confluence/display/CRMDOC32/CiviReport+structure+and+customization

Basically in your code u need to define column headers , generally we set it in select( )
So in your case it will be like
Code: [Select]
function select( ) {
        $this->_select = "SELECT id, display_name";
        $this->_columnHeaders['id']['title'] = ts('Contact Id');
       $this->_columnHeaders['display_name']['title'] = ts('Display Name');
 }

Rajan

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • No row data when writing a simple custom report type

This forum was archived on 2017-11-26.