View selection formula by UserName?

Hi,I’m a big problem that I’cannot solve…

I’ve a calendar view similar to Time Sheet…and I need that current user only can see documents that he’ve created.

So I’ve a field in every document (called UserName) that takes @Name([CN];@UserName).

And I’ve put as view selection formula this:

SELECT UserName = @Name([CN];@UserName)

but NOT WORKS!!!

Please help me…how can I solve this problem?

I’ve also tried to solve with a support field but nothing!!!

thankU :slight_smile:

Subject: View selection formula by UserName???

A few issues with this sort of code:

Server view indexing: @UserName returns the server name, not the current user

… you should therefore consider using a private view for this kind of thing.

If you want the view to be shared, then you need to think about using Readers field functionality instead: people will also see the data they’re meant to see that way.

It is possible to use username-sensitive selection in shared views – I think the tip is covered in full on Ken Yee’s site – but it requires that the view index be disposed-of after every use, so it thrashes the server. I would avoid doing this.

Subject: View selection formula by UserName???

View selection formulas are typically executed on the server, so the @Username will always return the name of the server - not the user.

To overcome this you must change your view to “Shared, Private on First use”.

Read the help for “Shared and Private views”

Subject: RE: View selection formula by UserName???

  Quote: "To overcome this you must change your                   view to "Shared, Private on First use"

Works great with a script that automatically removes private views. Thanks.

Subject: View selection formula by UserName???

The problem is that the selection formula is evaluated by the server, not the user. Unless you have the server creating documents, nothing will appear in your view. Do as follows:

  1. Insert another column as the first column in your view, make UserName the value. Categorize this column.

  2. Create a new form (or page), insert an embedded view control. Make the control display your newly-categorized view, and make the single-category value UserName.

When you view the form, the view control will display just the documents in the category. You can read more on this by searching Designer Help for “single category”.

An alternative is to use @SetViewInfo to filter the view on the fly after it opens (no intermediary form or page). This is new in R6. I don’t know if this works with a browser client, I expect it does not. I’ve only looked briefly at SetViewInfo; I got it to work OK for sorted columns but could not get it to work for categorized columns.

You should fall back on using Private On First Use views only as a last resort, and probably not even then. I’ve been developing in Notes since 1995 and I’ve never seen a case where the benefits of private views outweighed the hassle.