Advanced filter options

Default value for filters

Default value for filters is an option (from Totara 11) when defining embedded report or when defining the default reports through the define_defaultfilters method.

Values are saved when creating the reports.

The only thing that needs to be added is the defaultvalue option as an array with the corresponding filter options. 


  'type' => 'user',
  'value' => 'deleted',
  'advanced' => 0,
  'defaultvalue' => ['operator'=> 1, 'value' => 0]

For a real example check the "rb_system_browse_users_embedded" report which User Status filter is now set to Active users only, it can be found under Site administration > Users > Accounts > Browse list of users.

For more examples check totara/reportbuilder/tests/rb_filters_default_value.php

Trying adding new default values to embedded reports or in the define_defaultfilters method.