Totara Learn Open Discussions

Trouble getting embedded report default filter values to work

 
Conn Warwicker
Trouble getting embedded report default filter values to work
par Conn Warwicker, Wednesday 23 September 2020, 03:00
Groupe Partners

Hi,


I am having some trouble working out how to apply a default value to a filter on an embedded report.


I've looked at this documentation page: https://help.totaralearning.com/display/DEV/Advanced+filter+options


And have tried following that example and adding a defaultvalue to a filter in that format, but nothing actually happens, it never gets applied.


I have been through the code behind it and it seems that when it builds up the SQL for the filters, it checks the value of the array in $SESSION->reportbuilder[$reportid] and uses that, for example:


110 => 

    array (size=1)

      'user-deleted' => 

        array (size=2)

          'operator' => int 1

          'value' => int 0


However, nothing I do ever changes what is in that session, so my defaultvalues are never applied.


I ahve even gone to the example from that documentation (rb_system_browse_users_embedded) and simply changed `value` from 0 to 1 to see if it does anything (that should change the report to show ONLY deleted users, instead of NO deleted users). So I change the filter in that class to this:


array(

            'type' => 'user',

            'value' => 'deleted',

            'advanced' => 0,

            'defaultvalue' => ['operator'=> 1, 'value' => 1],

        ),      


But it doesn't do anything. I've tried purging cache, tried logging out and in, but the change is just not taking effect. And when I print out the $SESSION->reportbuilder property again, the value is still `0` not `1` as I changed it to.


Am I missing something here? I just can't see what I need to do to make these defaultvalues take effect?


Thanks.

----------------------

Totara 12.21

Conn Warwicker
Re: Trouble getting embedded report default filter values to work
par Conn Warwicker, Wednesday 30 September 2020, 01:47
Groupe Partners

Does anyone have any insights into what I'm doing wrong here?

Thanks

Craig Eves
Re: Trouble getting embedded report default filter values to work
par Craig Eves (Totara Support), Wednesday 30 September 2020, 15:12
Groupe Totara

hi Conn

This does look very similar to the example from the documentation - I will ask one of our developers on what needs to be done for this to take effect.

Regards