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 reports - custom fields in header?
Pages: [1]

Author Topic: Custom reports - custom fields in header?  (Read 955 times)

scrubba

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 2
  • CiviCRM version: 4.6.2
  • CMS version: Wordpress 4.2
Custom reports - custom fields in header?
October 26, 2014, 09:22:57 pm
Hi civi folks

I wondering about the best approach for some custom civi reports I aim to make

They are Events reports - and the 'Event Participants List' template is pretty close to my needs, so that is my starting point.

My question is about the header or equivalent area.

I have a bunch of custom fields attached to my events, (not the participants)
they include more detail about the event itself, e.g. some extra dates and extra venue and rehearsal venue information.

What i want to do is always add these to the header area of my report, just the once, above the columnHeaders and participant lists.

At the moment my only option seems to be to add these fields as columns, and they repeat at each participant row.

I see I could use the 'report header' section to manually add this information in each event report,
But is there a way I could automate this - by some kind of html call in the 'report header' to grab each field data
- or - alternatively by building a custom report / report extension - based on the template - and if this is possible any hints as to where in the report template php that may live, ie which function etc..


Thanks

Chris Dubrow





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: Custom reports - custom fields in header?
October 27, 2014, 01:47:26 am
Your best bet I think is to customize the standard report you change this. I can not judge from your question if you have any development skills?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

scrubba

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 2
  • CiviCRM version: 4.6.2
  • CMS version: Wordpress 4.2
Re: Custom reports - custom fields in header?
October 27, 2014, 03:47:33 pm
Thanks for the response Erik,

Yeah i can blunder through a bit of development
e.g. I have built a jquery extension before using civix to alter a profile form, and understand the basics

So figure i ideally should build a report extension following this
http://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Report-Template+Extension

But - I am still a little lost on where I where in the php I would alter, to add fields so it would display in the header area..

scrubba

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 2
  • CiviCRM version: 4.6.2
  • CMS version: Wordpress 4.2
Re: Custom reports - custom fields in header?
November 02, 2014, 07:01:36 pm
Ok haven't heard anything much on this - so thought I'd simplify the question

For my event reports I need to add an address of the event in the header area,

Does anyone know if there is way to automatically pull in this data?

I can create a edit the corresponding php (or tpl) file, and create a extension if required

But I just don't now where the fields would go?

(or perhaps someone would know if this is simply not possible, or not the best approach)

Thanks
« Last Edit: November 02, 2014, 07:04:28 pm by scrubba »

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Custom reports - custom fields in header?
November 03, 2014, 08:44:26 am
Hey there,

You are on the right lines.

Some reports have very complex tpl files, e.g. https://github.com/civicrm/civicrm-core/blob/master/templates/CRM/Report/Form/Contact/Detail.tpl

Others just include the standard one, e.g. https://github.com/civicrm/civicrm-core/blob/master/templates/CRM/Report/Form/Membership/Summary.tpl

So I would modify the form class so it gets the info you want and passes it to smarty.  Then I would add the extra smarty variables into the appropriate template.

If you are doing this in a few different report templates, one approach would be to create a function that you can call to get the appropriate event information into your report, and then write a template snippet that shows the event info that you want. You could then call the functiona and include the snippet as appropriate.

Obviously a few details missing above, but hopefully that gives you an idea (of how I would attempt it) to get you going
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

scrubba

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 2
  • CiviCRM version: 4.6.2
  • CMS version: Wordpress 4.2
Re: Custom reports - custom fields in header?
November 06, 2014, 03:02:23 pm
Thanks for the approach direction Michael - appreciated..
lets see how I go

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • Custom reports - custom fields in header?

This forum was archived on 2017-11-26.