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) »
  • Custom Report Query Problems
Pages: [1]

Author Topic: Custom Report Query Problems  (Read 1747 times)

leapywca

  • Guest
Custom Report Query Problems
October 20, 2009, 08:58:15 am
So first off let me start by saying that I am attempting to create my own custom report. Yes, I have created the proper custom_php and civicrm_custom folders for the custom php and templates, respectively. I used the documentation about creating custom reports (http://wiki.civicrm.org/confluence/display/CRMDOC/CiviReport+structure+and+customization) . I followed Case I on the directions as this report is a pre-made report that our non-profit currently uses so they should not need to populate fields. I tested the report by using my query as:  $myQuery = "select city from civicrm_address_en_oo";
That query actually returned all of the registered cities of participants (used translation from individuals-->participants). So therefore I know for a fact that my custom report at one time worked. The only changes I have made since then is rewriting the query because the previous query doesn’t do what I need – was just for test purposes.

I rewrote my query as: $myQuery = "select label_en_OO from civicrm_option_value where option_group_id = 27";
I tested this query beforehand in the mysql admin console within xampp. The query ran and it yielded the four values (program names) that I need for my report.
After making the changes I cleared the templates_c folder. Upon running the report I get the following error (I tried putting tick marks around columns/tables-didn’t work either):
DB Error: no such field
Database Error Code: Unknown column 'label_en_OO' in 'field list', 1054
Error Details:
Array
(
    [callback] => Array
        (
           
  • => CRM_Core_Error
  • [1] => handle
            )

       
Code: [Select]
=> -19
    [message] => DB Error: no such field
    [mode] => 16
    [debug_info] => select label_en_OO from `civicrm_option_value_en_OO` where option_group_id = 27 [nativecode=1054 ** Unknown column 'label_en_OO' in 'field list']
    [type] => DB_Error
    [user_info] => select label_en_OO from `civicrm_option_value_en_OO` where option_group_id = 27 [nativecode=1054 ** Unknown column 'label_en_OO' in 'field list']
    [to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="select label_en_OO from `civicrm_option_value_en_OO` where option_group_id = 27 [nativecode=1054 ** Unknown column 'label_en_OO' in 'field list']"]
)


Any ideas? Any help would be GREATLY appreciated... I've been trying since yesterday to solve this and have come up empty. Thanks in advance!!!

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Custom Report Query Problems
October 20, 2009, 10:04:59 am

your two sql statements are different, check

Code: [Select]
select label_en_OO from `civicrm_option_value_en_OO`

VS

Code: [Select]
select label_en_OO from civicrm_option_value where option_group_id = 27


the table names are different. You might want to fix your report to follow the first pattern

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

leapywca

  • Guest
Re: Custom Report Query Problems
October 20, 2009, 10:44:58 am
I tried your suggestion but that did not work either.

$myQuery = "select label_en_OO from civicrm_option_value_en_OO where option_group_id = 27";

leapywca

  • Guest
Re: Custom Report Query Problems
October 20, 2009, 10:49:46 am
We figured it out. My teammate figured it out more so. Apparently the tables with the addition of en_oo/en_us are view tables. Therefore the query needed to pull from the base table: civicrm_option_value and NOT from civicrm_option_value_en_OO

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • Custom Report Query Problems

This forum was archived on 2017-11-26.