This coding changed the SELECT fomula of the view for all users. And the idea with view.refresh din’t work as I expected. the change of the select formula workes only when I open the view the next time.
While you can force the view to be refreshed through LotusScript, this probably still wouldn’t solve your issue. As you said, the changes are effective for all users (and changing the selection formula every time a different user opens that view would be about the most stupid thing to do in Notes).
However, the fact that you got a number of very different responses indicates to me, that you didn’t give enough details on what you really want to accomplish. Notes is no relational database, so forget about any concept that’s similar to issuing a new select statement every time a view is used.
Still, there are plenty of ways to customize view behavior for different users. But there is no general option to make views “variable” with respect to anything. If you can be a bit more specific, it should be easy to identify what your best options would be.
The solution I posted yesterday WORKS. I use it all the time and it works without issue. I use it create views based on @Username - for example:
My Signature Required
My Documents
The user clicks on these views and sees ONLY the docs that fit the criteria in the selection formula using @Username.
You must consider where the username is kept (is it unique or in a string of names).
You can do:
Author = @Username or
@IsMember(@Username, Approvers)
Again -
Create a ‘Shared, private on first use’ view
This option is only available from the ‘New View’ dialog - I don’t believe you can select this attribute from a copy and pasted view or view that already exists.
Set the selection criteria as you want using @Username
The only thing I don’t like about this method is that any view changes will not be visible if a user has already opened the view.
But private views have their shortcomings (and you did mention one already). If the problem can be solved without private views (e.g. using a single category view), I’d always prefer that.
You can easily do this by creating a view using the view type as ‘Shared, private on first use’. You make this selection on the ‘New View’ dialog that appears.
In the view selection formula you can use @Username for this type of view. It will actually create a private view for each user that accesses it and store it for them.
The only warning I will give you is this. Any view updates that are done after the view has been used by the users will not visible to them so make sure the view is the way you want it when you publish it.
If all you need to do is select records in a view by user then use an embedded view in a form where the first field is the name of the user and use “show single category”.
In your navigator just use a button @Command([Compose]; @DBname;“Formname”)