Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

View selection formula 1

Status
Not open for further replies.

sutha

Programmer
Mar 10, 2003
4
CA
Hi Friends,

I created a monthly account statement (Document) for each branch in our company. I need to restrict each branch staffs to view only their branch report. Say for example, if they open the database, in the default view they should be able to see only their branch report even though the view contains the all branch reports.

To do this, when I create the report for each branch, in a special hidden field, I add all the user’s names whoever can view this document (Branch staff’s names). In view selection formula window, I enter the following formula

SELECT (@Contains (<Hidden Filed Name>; @UserName))

The application should check the current user name with the hidden field which contains the names and if the current user name available in that hidden field, that document should show in the view.

But it doesn’t work like this. Actually the document doesn’t show in the view even though the current user’s name is available in the hidden field. I’m using Lotus Notes R5.

Is anyone having any idea why it doesn’t work or any other way to handle this problem?

Any help you can provide would be appreciated.

Thanks.
 
What is happening is that you are experiencing the side effects of what a view is and where it is built. The view you are using is public, and therefore it is always maintained on the server.
That means that the selection formula is asking the server to list all views that the current user has access to. Unfortunately, when the formula is evaluated, the current user is the server - which means no document is displayed.
Try replicating the db locally and you will see a document if you have created one.
To solve this issue, make the hidden field a reader-type field, and leave out @username from the view selection formula.
Of course, you will also need to create a role and include that role in every report. Assign that role to the managers who should have access to all reports.
Another solution would be to make the view shared, but private on first use. In this case, it is the client that maintains the list (technically not always true since R5, but it all boils down to the same), so you can use @username in the selection formula and it will work as intended.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top