问题
I want to show to the users who are accessing the view the documents which are under him or her.
For example: If I have a field named "Name". There are 23 documents in the view and of all those documents, but only five of them have my name under "Names" field. I want to show in the view all those documents under me which would be five documents.
Could you please help me? I appreciate it a lot.
回答1:
Create a Page with an embedded view.
Categorize view by field Name
.
Put into embedded view's property "Show single category" the formula @UserName
or@Name([CN]; @UserName)
depending on how your field Name
is formatted.
Show the Page instead of the view.
This way you avoid trouble with "Shared, private on first use" views or similar approaches and users see exactly their own documents only.
回答2:
Are you doing this for convenience purposes, or for security purposes? If it is the latter, then Notes has a feature called Readers (or Reader Names) fields that does exactly what you want. I.e., if you select "Readers" for the type of your field called Names, then all the views in the the database will behave the way you want. I.e., they will show each user only the documents that have their name in the Names field.
There are several caveats to this...
- The Names field must have the "allow multi values" property. (This is probably true for most solutions you could consider.)
- The user names in the Names field should either be in canonical format or flat (common name only) format.
- Changing the type of the field will have no effect on existing documents until you refresh the fields in those documents.
- It is usually a good idea to add a role to the value of the Names field for all documents so that administrators who are granted the role in the database ACL can see all the documents.
回答3:
If you need this for Lotus Client use only... you can do it, but it's tricky and requires a bit of familiarity with the Notes Views.
You need to create a "Shared, Desktop Private at First Use" view. You'll have to create a new view from scratch, since you cannot convert an existing "Standard" one into a "Private" one. The option to do so, is in the "Create View" dialog, under the View Type drop down list to the right of the View Name field.
A private view will appear with a yellow key besides its name in the views list.
A private view differs from a shared one in the fact that the view itself is copied into the client desktop file as soon as any user opens it the first time (including you!). For every subsequent opening after the first, the (local) client copy is used instead of the (shared) server copy.
This has one advantage and two drawbacks.
The advantage is that now you can define custom selection formulas based on the
@UserName
function. For example, following your request, you can define your selection formula asSELECT ((Form = "MyForm") & (Name = @UserName))
Doing so each and every user who will open said view once, will be seeing only the documents in which the Form field is "MyForm" and the Name field equals their username.The drawbacks are that, if you need to perform maintenance on a private view (e.g.: change, add or remove a column), you need to clear all the local copies on all the clients that opened the view once. This is performed by simply removing the Application icon from the Notes desktop (a popup will warn you that removing the icon will delete locally stored views) and reopen it. If you don't do that, the clients will continue to use the old view design, as stored in the locally-stored copy, instead of the new freshly-edited one. Also, private views don't work if you use the application via webbrowser and this is the second major drawback
One trick to avoid the need to remove the application icon to clear old views design, would be to name the view differently each time you need to edit it, forcing the users to store another fresh copy (for example if the view is accessed via an outline link). But this would leave behind a number of dirty clients with old, dead views stored inside them, still accessible if the user has access to the "right-click > go-to" menu.
Two things are also to be kept in mind about "Shared, Desktop Private" views:
- they are stored in the local
desktop*.dsk
file. Deleting such file will also delete all private views from all the applications opened in the user's client. - they are client dependent, not user dependent. This means that the same user using the application from another client will use the views stored on that client, which may already have been accessed before by another user, and therefore will be customized by that username.
来源:https://stackoverflow.com/questions/32057349/notes-view-how-can-i-show-only-those-documents-which-are-under-the-users-name