View to display documents by the current user.

reference answer:

I have been trying to create a view to show the documents created by the current user accessing the view. I thought I found it in the question referenced above.

Here are the details:

1. I created a view with the View Type option set to "Shared, Private on first use."
2. The selection criteria is set to: SELECT (@Name([CN]; Author) = @Name([CN];@UserName))

It appeared to work fine, but I have a couple of reservations.

This is what is in help on "Shared, Private on first use.":

Shared, private-on-first-use views
A "Shared, private-on-first-use" view begins as a shared view and becomes a private view as soon as a user accesses and saves the view. These views give you a convenient way to distribute personal views to multiple users. You usually create this type of view by using @UserName to customize the display for each user.
Note that this is the only way to make a view work with @username, because the view selection is only parsed when the view is generated. Thus, if Tom opened a shared view that keyed to @username, all of Tom's documents would display. But, if the view is still open when Jay accesses it, Jay sees all of Tom's documents, and does not see his own. So, to avoid this conflict, designate the view as "Shared, private on first use" when using @username in the selection formula.
After a user saves a shared-to-private view, the user's copy of the view no longer inherits design changes. For example, if you add a column to the view, anyone using a private version of the view won't see the new column. To obtain design changes, users must delete their private versions of the view and open the shared-to-private view again.
Shared-to-private views are not a security measure, as they do not protect data. If you create a shared-to-private view that omits certain documents, a user can still create a private view that includes them.
Shared-to-private views are stored in the database as long as they are shared. After the first use, Domino uses the "Create personal folders/views" option to determine where to store the view.


As it says above, a new view and view index are created for each user, however, the problem is that the new views are set to not refresh and from what I can see, the design and data is only viewable by the user they are created for. As a Manager, I cannot go and force a new design down, I cannot flush views so they can be recreated, I cannot clean them up, I cannot set them to refresh design, since I cannot even se them, etc. etc.

The only work around that I see is that if I made a design change to the view, I would have to rename it, update all code that pointed to it, people accessing it would create all new private views the next time the accessed the view, but the old views would still be setting out there taking up space. The only way I know of to remove an old personal view would be to have the person it was created for to go in and delete it. Not exactly an efficient answer.

Anyway, if any of you very bright people out there has an answer to this, I would appreciate it.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

Sjef BosmanConnect With a Mentor Groupware ConsultantCommented:
Buy two cakes  :-))

You're right about the column sorting, but... you can also specify that clicking on the column header will move to a different view. I know, p.i.t.a., you have to create more views and pages than strictly necessary, but that's the price you pay for two cakes.
Steve KnightConnect With a Mentor IT ConsultancyCommented:
One other way is to have a form with an embedded view.  The first column of the view is @username and is sorted and catergorised.  You can make an embedded view show just a single category so enter the formula there of @Username too.  No they can just see their own docs.

Steve KnightIT ConsultancyCommented:
Sorry, for form read Page.
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

NormCoxAuthor Commented:
This is a viable solution. The main drawback is that the user is unable to click on column headings to sort. Are there alternatives that allow me to have my cake and eat it, too? ; )
Steve KnightIT ConsultancyCommented:
Er I've got views embedded in pages in an R5 system here and the column headings show and you can click on them to sort as long as you add the additional sort orders.  Haven't tried the functionality out in R6 or R7 specifically so may have changed??

Sjef BosmanGroupware ConsultantCommented:
AFAIK, if you enabled Show single category, and you click a column, ALL documents will be visible because there's no category any more.
Steve KnightIT ConsultancyCommented:
Erm, yes. true... checked it on a none single-category embedded view.

Crawls back into hole.

Haven't done any development on R7 yet, anything on there that would help?

Sjef BosmanGroupware ConsultantCommented:
Haven't found it (yet)...
NormCoxAuthor Commented:
I finally got this. I forgot to add that I am programming in 6. In 6, there is a new command called  @SetViewInfo. You add this on the line after your OpenView Command. I categorized the first column of the view by author, named the column Author and then used the line: @SetViewInfo([SetViewFilter];@Name([CN];@UserName);"Author";1)

It opens the view and displays all the docs that the current user authored, I have full view functions and I do not have to mess with private view indices.

I am having my cake and eating it too.

One side effect, if you use this to open another view in the database, once this view is opened, the database attempts to try and use this line when opening up all other views, so you have to add the line after all OpenView commands with the first column of the view and an empty string to override the original.

Hopefully, this all makes sense because I am on my out the door for the weekend.

I don't think I can give myself points so I will split them evenly between sjef & dragon, not they need them since they are point baziollinaires anyway.

Thanks for the help and Go Cards!!!
Steve KnightIT ConsultancyCommented:
Cheers for that, bit worrying really isn't  it - I'm certified as an advanced developer in r6 (pclp as was) but haven't touched dev except r5 for a year or so due to customers still using that ver.... will have to update some of the old dbs with new functions like this once I can before I forget any more of it!  
Sjef BosmanGroupware ConsultantCommented:
Hey thanks!

I toyed with @SetViewInfo (of course :-$ ) and I noticed an irritating behaviour of the Notes client: right before the call, the whole view was visible, just for an instant, and when @SetViewInfo kicked in, only the one category was displayed. So I decided to place it in the functions archive under Nice; Who knows; Perhaps; Maybe; Must review in R7. It's here, somewhere, under a thick layer of dust...

I think I'm certified, but definitely not as R6 CLP... :-))
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.