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) »
  • How to determine URL query string for a report
Pages: [1]

Author Topic: How to determine URL query string for a report  (Read 1606 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
How to determine URL query string for a report
April 26, 2012, 08:01:35 am
I would like to create a hyperlink to the report "Activity Detail Report"  with the filters set in the query string. ( This way I can create a Drupal menu item to certain commonly used report filters.

The filters I want to control via the URL are: the source contact, and the date range.    Where can I find the documentation on the query string parameters?

Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: How to determine URL query string for a report
April 26, 2012, 02:38:48 pm
I'm guessing you're not just creating an instance because you want the defaults to be dynamic relative to current user and current date. I tried url params on reports a while ago without much success - not sure if it's now possible in recent versions. But what you can do is copy and paste the report code file, give it a new name and class, and then make that one do what you want:
http://wiki.civicrm.org/confluence/display/CRMDOC41/CiviReport+structure+and+customization

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: How to determine URL query string for a report
April 27, 2012, 03:50:03 am
In addition to creating the Drupal menu item, I intend to use the URL as a "drill-down" link on another report. (The url in this case will be constructed dynamically, based on which row the user is on.)     Doesn't seem realistic to create a custom report for each row that might show up in the other report.
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: How to determine URL query string for a report
April 27, 2012, 08:50:29 am
Your custom report could pull out the url params and then do whatever with them.

Otherwise you can try playing with variations of a url like this:
http://drupal.demo.civicrm.org/civicrm/report/instance/3?reset=1&force=1&activity_date_time_from=20120101&activity_date_time_to=20120201&contact_source_value=Adams
As noted I didn't have a lot of success when I tried this type of thing before. It seems to accept the values but doesn't quite.

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: How to determine URL query string for a report
April 29, 2012, 08:14:12 pm
The query string you suggested worked for me, for accessing the "Activity Detail" report with parms.   What issues did you run into when you said it "kinda" worked?

Also, is there a standard pattern that one can use from looking at the field names in the "Report Criteria" section, in order to determine the query string?
Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: How to determine URL query string for a report
April 30, 2012, 08:09:14 am
I mean it appears to fill in the fields on the form but then didn't return the right results.

You need to look in the report code to see the actual filter name (filters array key). Then see CRM_Report_Form::where()

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • How to determine URL query string for a report

This forum was archived on 2017-11-26.