Is there any trigger for when users apply a filter?

steinarsigsteinarsig Member Posts: 8
edited 2014-10-22 in NAV Three Tier
I have a list page (Dynamics NAV 2013 R2) which includes a Repeater Group. To the side I have a FactBox which calculates a handful of statistics based on the records in the list (Total Amount, Number of Records etc.). I have a function (Action in the Ribbon) which updates the summary based on the filters that a user has applied.

I would however want to be able to perform this update automatically whenever the user applies a filter.

Is there any way to catch this event?

Answers

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    There is no trigger.

    What you can do is keep the current value of GETFILTERS in a global variable and as soon as that changes in the OnAfterGetCurrRecord trigger you need to update.
  • rmv_RUrmv_RU Member Posts: 119
    steinarsig wrote:
    I have a list page (Dynamics NAV 2013 R2) which includes a Repeater Group. To the side I have a FactBox which calculates a handful of statistics based on the records in the list (Total Amount, Number of Records etc.). I have a function (Action in the Ribbon) which updates the summary based on the filters that a user has applied.

    I would however want to be able to perform this update automatically whenever the user applies a filter.

    Is there any way to catch this event?

    Try to use Form - OnActivateForm() trigger.
    Looking for part-time work.
    Nav, T-SQL.
  • jreynoldsjreynolds Member Posts: 175
    OnFindRecord on a page fires whenever the filters change.
  • rmv_RUrmv_RU Member Posts: 119
    jreynolds wrote:
    OnFindRecord on a page fires whenever the filters change.
    Yes. But it's probably too expensive.
    Looking for part-time work.
    Nav, T-SQL.
  • steinarsigsteinarsig Member Posts: 8
    There is no trigger.

    What you can do is keep the current value of GETFILTERS in a global variable and as soon as that changes in the OnAfterGetCurrRecord trigger you need to update.
    Thank you.
    That works perfectly. Here's my code:
    OnInit()
    LastRecFilter := Rec.GETFILTERS;
    --------------------------------------------
    
    OnAfterGetCurrRecord()
    IF FilterChanged THEN
      DoSomething;
    
    --------------------------------------------
    FilterChanged() : Boolean
    IF LastRecFilter <> Rec.GETFILTERS THEN BEGIN
      LastRecFilter := Rec.GETFILTERS;
      EXIT(TRUE);
    END ELSE
      EXIT(FALSE);
    
  • rsaritzkyrsaritzky Member Posts: 469
    I have the same scenario in NAV2009. Is there a way to get a factbox to update after setting a filter? My factbox is simple - it's just a count of the records in the list being displayed.
    Ron
Sign In or Register to comment.