I am trying to understand how a shared view being accessed only via the web would know which user is accessing it. Right now my view has a selection formula that users @Username. It works in very predictably 99% of the time with a problem only when two users hit the view at approximately the same second. Then, sometimes, UserA sees UserB’s documents instead of their own.
Is the index getting rebuilt each time a different user accesses the view or is there one index and the server is wrongly calculating who they are sending the view to? Or is there something in cache somehow? I am trying to figure out why the problem only occurs when there are two users accessing simultaneously. Under very regular use by web users for several years, this is the only time we have a problem.
I have read all the threads about how it could be better done with an embedded view that shows a single cagtegory, but this is not a categorized view. The database stores appointments and the view is designed to show a user their appointments only, in a calendar format. Readers fields also wouldn’t apply since for other purposes they do have the ability to read and edit the appointment documents that are not scheduled for them.
In the Lotus documentation has one sentence that says the results are unpredictable (although i seem to be able to predict when I will have a problem) and then the next sentence says it can be used in the manner i am using it. Here is the quote from the documentation I am referring to:
You should not use @UserName in a public view, doing so produces unpredictable results. Also, if the field that you are referencing changes, you will get unpredictable results because the index has to be rebuilt to accommodate the new information.
One use for @UserName is to display only those documents relevant to the current user. For example, your Service Request database could use @UserName in the private view named Assignments to display each technician’s assignments, weeding out everyone else’s:
SELECT @UserName=AssignedTo
Subject: How does a Shared View know the Username?
My understanding is that all the cautions you listed are correct. You should NEVER user @Username in a view selection. Implement an embedded view solution.
Subject: RE: How does a Shared View know the Username?
My problem is I need the view to be in calendar format. I could write an agent and try to design something elaborate to look like a calendar, but what would make an agent compute properly and not a view. I am worried (I guess because I don’t understand why it doesn’t work only when 2 people hit at the same time) that even an agent accessed by 2 users at the same time might end up with the wrong info being sent to one of my users.
Subject: RE: How does a Shared View know the Username?
Shared views really shouldn’t use the @Username function in selection or column formulas.
Have you thought about using a “Shared, private on first use” view? They have their own special problems because the design is copied locally by each user the first time they open it and is therefore not updated by server design refreshes, but you can use the @Username function reliably.
Subject: RE: How does a Shared View know the Username?
I don’t know if the Shared, private on first use really pertains to what I am doing since the view is only accessed over the web through the browser so people aren’t doing anything through any clients or anything local like that. I had read in another thread that Shared, private on first use would create different indexes for each user on the server but when I read about it I couldn’t really find if this is true?Does anyone know if this would be the case and if so, how much more labor intesive would it be on my server?
Subject: RE: How does a Shared View know the Username?
If your goal is to have a calendar view that displays only the ifno based on the current user, you probably want to use an “embedded/show single category” view. Lookup Views / Single Category in designer help.
Subject: RE: How does a Shared View know the Username?
Thanks I use embedded/show single categories in other circumstances, but for this issue I am trying to get the view to display the appointments in a calendar format which doesn’t allow for the first column to be categorized. Is there any way to get the view to grab the appointments by username and then get them into a calendar format so that my users only see their appointments on the calendar?I still wish I could understand why a problem like this would only occur when the view is hit at the same time by users accessing via the web and at all other times it works. Is there anyone who understands the technical reason how the server knows which user from the web is accessing the view to perform the computation and why the timing would affect this?
Subject: RE: How does a Shared View know the Username?
Hi
AFAIK, the domino server calculate the (sometime temporary) index at each access to the view.
Two accesses at the same time will most probably mix the two indexes.
This is a very quick technical explanation, but I truely believe that it is true,
because considering that documents are static informations for the server, and that the username
is an external dynamic one, it seems to be the only reason.
Another way could be using readers field, no ?
HTH
ian
Subject: RE: How does a Shared View know the Username?
Readers fields do not work for me because in other circumstances i need the users to be able to read the other documents in this database, I just want to make a calendar view to show them only their appointments in this calendar format. I was hoping there was some setting in the server document or something that would force the server to handle these users one at a time so that if they were to hit at the same time it wouldn’t mix them up for some reason. It does not look good when a user sees someone elses calendar. Even though it is not a security issue in our situation it doesn’t look good and my goal to keep the view in calendar format is preventing me from doing the embedded view/show single category solution.