« Unrestricted - that is to love (my cover) | Main| Composite Application Debug Tools »

@SetViewInfo([ResetViewFilter]) (I wish)

Tags: development

Today I was struggling again with @SetViewInfo. Although the idea behind this function is very nice, the implementation sucks (a little). Basically @SetViewInfo allows to restrict a view to display only documents from a single category. This is very nice to create a "my documents" view by making the first view column categorized and hidden displaying abbreviated user names. In the PostOpen event of the view insert a few lines of code:

REM {Set view filter for user's documents};
_user := @Name([Abbreviate]; @UserName);
@Command([ViewExpandAll]);
@SetViewInfo([SetViewFilter]; _user; "TheColumnName"; 1)
The disadvantage of @SetViewInfo is that the view filter remains active until the database is closed. So you will need to somehow reset the view filter when the user switches to another view. The easiest solution would be to put @SetViewInfo([ResetViewFilter]) or some such in the QueryClose event of the view. Unfortunately this parameter does not exist. A technote suggests to put @SetViewInfo([SetViewFilter]; temp ; 0 ;1) in the QueryClose event of the view (although undocumented and unsupported). Unfortunately this only throws a "Cannot execute the specified command" error ("This problem was resolved as: No Plans to Fix Ever").

I noticed that using

@Prompt([OK]; "You are about to close this view."; "Thank you for using this view. " + @NewLine +
"We hope you enjoyed your stay and are looking forward to seeing you again soon. " + @NewLine +
"Please press OK to actually close this view.");
@SetViewInfo([SetViewFilter]; temp ; 0 ;1)
did work. Quite understandably I didn't want to be tarred and feathered by the end users for this needless prompt, so I looked a bit further and finally came across a thread in the developerWorks Notes 6 and 7 Forum where Andre Guirard finally had the solution to put an end to my ordeal. Putting
@SetTargetFrame("NotesView");
@UpdateFormulaContext;
@Command([OpenView]; @Subset(@ViewTitle; -1));
@SetViewInfo([SetViewFilter]; ""; "TheColumnName"; 1)
in the QueryClose event resets the view filter successfully.

Thanks, Andre!

If you want to reset a view filter in the current view and want to go to the top of the current view there's a nice workaround Heinz-Ulrich Krause posted about a year ago.

Comments

Gravatar Image1 - It would be too much to expect this to have been properly thought through! Emoticon

Unfortunately in Notes 7, Andre's solution gives me an error: "Attempt to infinitely recurse on resource link."

Back to the drawing board for me!

Gravatar Image2 - I am using notes 8 and I also receive the same errorEmoticon

Gravatar Image3 - Works for me in Notes 7.0.2, but only if I open the view "alone". If I put it in a frame, it stops working/works in weird way (opens my prefered category, but showing still all the other categories).

Any idea?

Gravatar Image4 - I received same error (crashing Notes client) as Simon and George when view was open from different database than outline. In other cases it works well in R8 for me. I played with your original "prompt" solution and found that it works with @DialogBox too. So I use this:

@DialogBox("SelfClosingForm";[AutoHorzFit]:[AutoVertFit]:[ReadOnly]:[SizeToTable]:[NoOKCancel];" ");
@SetViewInfo([SetViewFilter]; temp ; 0 ;1)

SelfClosingForm is a form with small empty table. Sometimes it is shown shortly, sometimes not, but it is little better than a needles prompt. It works fine.. Emoticon

Gravatar Image5 - I forgot to mention an important (but easy) thing - there is @Command([FileCloseWindow]) called in PostOpen event of SelfClosingForm..

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)

Search

Calendar

MiscLinks

We Use Ytria Lotus Notes Tools For Faster Notes Development and Better Domino Administration

Tags

Site Info