lazexe
lazexe

Reputation: 369

Selection formula in View Lotus Notes

I have a form (NewDocumentForm) where I create documents. And also there is a field (name: reader_field) that keeps roles of ACL that can read this document.

Next I create a view (MainView) to display this documents and I have a problem with View Selection formula.

My task is to show in MainView the documents to user where he has role to read this document (this role in reader_field).

So in Selection Formula I write the next:

SELECT (@Contains(reader_field; @UserRoles)); <- there is not that I need...

SELECT @IsMember(reader_field; @UserRoles); <- there is not that I need...

If you understand my question please give me advice. Thanks.

Upvotes: 0

Views: 2826

Answers (2)

user2808054
user2808054

Reputation: 1386

Is the field reader_field actually a Notes "Readers access" field ?

You can tell by checking the field in the Notes document properties box. You should see for that field:

Field Flags: SUMMARY READ-ACCESS NAMES

If that's the case, then the field reader_field will automatically limit who can see those documents in the view to those with the role in the field.

So your selection formula can allow everyone to view it, and the readers_field will limit it as necessary. This works for web applicaiton & Notes client.

Be sure to add a 'catch all' readers field as well as it's entirely possible to accidentally hide doecuments with a Readers field such that no-one can see them. If you add for example an [Admin] role (it can be in another field of type Readers on same doc) which only support staff have, then you have a way to see all documents, for support purposes.

If it's just a normal text field called reader_field....

If a Notes application: About your only option is to use private views (bit too much to explain here)

If a Web application: You can categorise the view by the reader_field and use a form to include the view with a view embedded element. Use the "Restrict To Category" setting to the user's role (if they have >1 role then you'll probably have to put some logic in to work out which one is appropriate)

Another alternative would be to display the view using an XPage, which allows you to trim the data as it's displayed.

Upvotes: 1

Knut Herrmann
Knut Herrmann

Reputation: 30960

You can show all documents in view. You don't need to select the documents for user as the user can see only those documents in view the user has access to.

Actually, @UserRoles won't work in a view SELECT as the view is calculated on server. You could use private views but that has a lot of side effects you probably won't deal with. So, don't worry. Users will see only those documents in view they are allowed to by their roles.

Upvotes: 3

Related Questions