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) »
  • Developer Discussion »
  • Report and Search UI Discussion (Moderators: CiviTeacher.com, TwoMice) »
  • <solved>In custom report, specialized SQL is not used for "Export CSV"
Pages: [1]

Author Topic: <solved>In custom report, specialized SQL is not used for "Export CSV"  (Read 1014 times)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
<solved>In custom report, specialized SQL is not used for "Export CSV"
March 12, 2014, 04:42:14 pm
I have written a custom report which overrides the function buildQuery( ) to create a very specialized SQL select statement.  This works fine when the end-user is viewing the results.   However, the custom SQL is NOT used when the user clicks "Export CSV" and so they get different results in the CSV file than they see on the screen.

Any ideas on how to get the "Export CSV" button/action to use the SQL that I create in the function "buildQuery"
« Last Edit: March 13, 2014, 08:45:57 am by epg »
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: In custom report, specialized SQL is not used for "Export CSV"
March 13, 2014, 01:27:33 am
Do you store your sql in the class variable ($this->sql)?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: In custom report, specialized SQL is not used for "Export CSV"
March 13, 2014, 06:34:28 am
Yes, I do have the line " $this->sql"  in my buildQuery()  function.
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: In custom report, specialized SQL is not used for "Export CSV"
March 13, 2014, 06:58:47 am
You need to check the export CSV function CRM_Report_Utils_Report::export2csv($this, $rows)
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
<solved> In custom report, specialized SQL is not used for "Export CSV"
March 13, 2014, 08:45:27 am
Thanks for the help everyone. The export to CSV was calling my custom SQL. The problem existed elsewhere in the code
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • Report and Search UI Discussion (Moderators: CiviTeacher.com, TwoMice) »
  • <solved>In custom report, specialized SQL is not used for "Export CSV"

This forum was archived on 2017-11-26.