Add default values to columns and filters in report builder

Once a report has a large number of column and filter options it can be useful to define a set of default options. The default value for report sources can be added by changing the code of the report source.

Follow these steps to amend the default values for a report source:

  1. Find the report source that requires a default value - this will be in the \totara\reportbuilder\ folder.

  2. Use a text editor (e.g. Notepad) to edit the file.

  3. Locate the column or filter field array.

These columns and filters will be automatically added to any new report that is based on this source. This can give users a headstart by generating a 'typical' report which they can further customise.

To add default column options, add a new property to the class called default columns:

$this->defaultcolumns = array( array( 'type' => 'course', 'value' => 'fullname', ) );

The 'type' and 'value' must match an existing column option.

To add default filters use a similar syntax:

$this->defaultfilters = array( array( 'type' => 'course', 'value' => 'fullname', 'advanced' => 0 ) );

The 'type' and 'value' elements match the column the filter is applied against. The 'advanced' option is described in the advanced filter options section of the public developer documentation.

For Totara 11 onwards, please see the report source rb_system_browse_users_embedded embedded report, for which the User Status filter is now set to Active users only.