Share filter between tabs on a browse

I have a browse with 3 tabs using different sort keys and a control that stores a variable responsible for browse filter value. When this control is accepted I call this code

    CASE FilterValue
    OF 1 !
       BRW1.SetFilter('(PRE:Field1 = 0)','MyFilter')
    OF 2 !
       BRW1.SetFilter('(PRE:Field1 <> 0)','MyFilter')
    OF 3 ! All records, clear filter

and also in “Browse After the initialization” embed to apply it when browse is opened (variable is stored in ini file)

The problem is that when user selects other tab the filter is not applied - all records show on a browse. I have to click on the filter control to execute the above code. Looks like the filter is appled “per tab” as I can apply different filters for each tab and when I change tabs these filters are in place. How can I apply my filters to all tabs (sort orders) ?

Put a call to set your filter logic in the browse ApplyFilter method before the parent call.

1 Like

Thanks. I did try a couple of embed points before including this one, but my code caused browse window to close the whole application when called. But apparently that was due to calling Reset method in there. Now that you pointed me to this embed I reviewed my code and removed the reset method and it works fine. So now calling it only after my filter control is accepted.