@SetViewInfo, Reset Filter and Goto Top Of View

When using @SetViewInfo to filter a view, you can reset the filter with the following formula:

@SetTargetFrame("NotesView");
@Command([OpenView]; @Subset(@ViewTitle; -1));
@SetViewInfo([SetViewFilter]; ""; ""; 1)

This will work fine as long as you do not want to go to the top of the view after removing the filter.

This is the view before setting the filter

Now we set a filter to show only entries according to a selected ticket number

Don’t be confused that the first column isn’t shown after the filter is applied ( Notes works as designed )

Now we remove / reset the filter using the formula show before

The filter is removed but the view does not show the entries from top of the view

Here is my workaround for this problem. I found out that the view opens from top, when you change to another view first and then re-open the view in question. So what can be done manually could even be done programmatically.

To avoid opening an existing view in the database with possibly a lot of documents in the view, I created a “dummy” view.
This view neither shows any documents nor it has columns and actions. A real empty view, indeed.

At least I changed the “Reset Filter” action to the following code:

@SetTargetFrame("NotesView");
@Command([OpenView];"dummy");
@Command([OpenView]; @Subset(@ViewTitle; -1));
@SetViewInfo([SetViewFilter]; ""; ""; 1)

When you now reset the filter, the view will open from top.

Technorati:

One thought on “@SetViewInfo, Reset Filter and Goto Top Of View

  1. Nice tip – indeed I have used it in an application this morning. This behaviour has always bothered me and must be a bug as I can see no reason for it to work this way.

    Thanks for sharing!

Comments are closed.