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 would I split a report into pages based on data?
Pages: [1]

Author Topic: How would I split a report into pages based on data?  (Read 1549 times)

nickholden

  • I post occasionally
  • **
  • Posts: 111
  • Karma: 1
  • CiviCRM version: 4.4.1
  • CMS version: Drupal 7
  • MySQL version: 5.5.32
  • PHP version: 5.4
How would I split a report into pages based on data?
January 11, 2013, 04:02:08 am
We've had a request for a custom report template and I'm working on some ideas to deliver the report content, but one of the things we'd really like to do is to enable a user to specify one (or more) columns of data to be the trigger for 'page breaks' in the PDF or the csv file.

Currently we can filter a report by certain columns, which can restrict the result set, but if you have maybe 10 possible values for that column, and want a separate listing for each value, that implies either not filtering the report and then splitting it in excel or some other application, or running the report 10 times, filtered to one of the possible values.

What would be valuable would be to add a third part of the report form (first part determines which data is included, second part determines which filters to use, third part would say which column(s) is/are the 'splitting' column. Or each data element in the 'Display columns' section could have an option tick box for 'split report into pages when this value changes'.

I'm thinking that the way to do this would be to introduce a third array in the $this->_columns property along with the fileds array and the filters array, such that entries in the 'pagination' array are presented in the template as having the potential for page splitting. It could then be up to end users to determine if they want the page splitting by values in that column.

A few questions:

Has anyone implemented anything like this so far? Would anyone be interested in working on a solution for it? And does anyone know how you force a page break in a PDF or CSV file as it is being written?

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: How would I split a report into pages based on data?
January 11, 2013, 08:01:33 am

here's the needed html to insert in the html to get pdf to generate a page break

Code: [Select]
   <div style=\"page-break-after: always\"></div>

this works for dompdf, not sure about other pdf libraries (like wkhtmltopdf) and is used here: CRM/Utils/PDF/Utils.php

 Note that most good reporting systems would also regenerate the headers / footers on a page break rather than just splitting the page at that point


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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • How would I split a report into pages based on data?

This forum was archived on 2017-11-26.