Building custom reports

The Webform Report module provides a neat interface for us to define custom report layouts based on submitted Webform data. The reports are sortable, searchable, downloadable, and highly configurable. Webform Report creates a new content type for our Drupal website and provides a set of user permissions similar to most content types (for example, access, editing, and so on).

Getting ready

Let's navigate to the Webform Report homepage at http://drupal.org/project/webform_report and download the latest 7.x version. The compressed folder needs to be extracted in sites/all/modules so that we have sites/all/modules/webform_report.

Now we navigate to our site's Modules page to enable the module by checking the box next to its name and clicking on Save configuration.

How to do it...

Let us build a report that will list the speaker presentations currently approved for our Fictitious Conference.

  1. Click on Add content in the menu toolbar and select the Webform report content type.
  2. Enter the value Scheduled presentations as the content Title.
  3. Select Speaker Registration at the Webform select list.
  4. Scroll down to the bottom of the page and click on the Save button.
    How to do it...
  5. Let's click on Edit and then select the Report Criteria subtab so that we may configure our report.
  6. In the Report Columns fieldset we select First name for Add Column and click on the Add Column button to add the first bit of data to our report.
    How to do it...
  7. Now let's select Last name for Add Column and click on the Add Column button to add the component to our report.
  8. Finally we select Presentation title for Add Column and click on the Add Column button to add the component to our report.
    How to do it...
  9. In the Filters fieldset we select Status from the field list at Add Filter and click on the Add Filter button.
  10. Let's select equals from the select list at Filter Type and enter the Filter Value of Accepted.
    How to do it...
  11. Scroll down to the bottom of the page and click on the Update button.
  12. Now we click on View to see our report listing all speaker registrations with an Accepted status.
    How to do it...

How it works...

Webform Report is, essentially, a query builder that helps us to pull information out of the submissions made on a Webform.

Our first step is to specify the fields we would like to see in the report and the sequence in which they should appear. Several operations become available to us when we have added fields in the Report Columns fieldset. We may move fields up or down, move them to the top or bottom of the list, or trash them if we find that we selected an unnecessary field. Any fields we may require for filtering or sorting purposes, but do not wish to have included in the display, may be marked as Hidden.

The Filters fieldset is where we specify conditional criteria that define whether to include (or exclude) submissions based on submitted data values. While specifying our filters we must heed the warning that All filters are ANDed together to avoid unexpected results. Data from a particular submission will only be included if all of the specified filter criteria are satisfied.

Although the reports are sortable by clicking on the field headings, we may specify an initial sequence for the data by adding fields in the Sort By fieldset. Once fields have been selected we may indicate whether we wish for the field to be sorted in ascending or descending sequence.

There's more...

We have discussed the query building nature of Webform Report, but that is not all there is in this module.

Including submission metadata and links

While adding columns to the report, we notice that we are also able to include various submission metadata fields and links to View, Edit, or Delete the listed submissions.

Including submission metadata and links

Tweaking options

The Options fieldset on the Report Criteria page offers several ways to customize the display of our report. We will normally want to keep the Results per page set at 20 (the default minimum) to prevent server overload if this report is expected to attract a lot of browsing traffic.

Tweaking options

As we saw when we viewed our report, visitors to this page will have the opportunity to Download as CSV. Checking the box at Hide CSV Download option removes the download link from the report display.

Checking the Display Search Form option will enable users to search the submission database for specific values in a selected field. The Report Layout options are Report (renders as an HTML table, one submission per row) or Submission (an HTML table resembling the standard Webform submission View).

Setting role permissions

An important step to remember is to correctly set permissions for the various roles that need to have access to the reports we create. To assign these permissions we navigate to People in our menu toolbar and click on the PERMISSIONS tab. We will find the Webform Report permissions below Webform in the list.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset