Creating a variable view

I’d like to create a view that uses arguments dependig on the user that uses the view.

I learnd, that dblookup doesn’t work. SO I tried to use SELECT together with @environment, that doesNt work either.

Next I tested Userprofiles.

@Environment and @GetProfileField works fine in Forms but not in the selection formula for the view.

Is there a way to use Userprofile depending arguments in the SELECT statement of a view?

Thanks in advance

         stephan

Subject: Creating a variable view

you can always create your view using script

John

Subject: RE: Creating a variable view

Hi John,

I’ve tried something like this:

Dim ws As New NotesUIWorkspace

Dim uidb As NotesUIDatabase

Dim uiview As NotesUIView

Dim view As NotesView

Dim formula As String

Set uidb = ws.CurrentDatabase

Call uidb.OpenView(“V001”)

formula=“SELECT ((Form = ‘Massnahmenblatt’) | (Form = ‘FRM004’)) & (@Contains(shr_Standort;‘Hamburg’))”

Set uiview = ws.CurrentView

Set view = uiview.View

view.SelectionFormula = formula

view.Refresh

This coding changed the SELECT fomula of the view for all users. And the idea with view.refresh din’t work as I expected. the change of the select formula workes only when I open the view the next time.

stephan

Subject: RE: Creating a variable view

While you can force the view to be refreshed through LotusScript, this probably still wouldn’t solve your issue. As you said, the changes are effective for all users (and changing the selection formula every time a different user opens that view would be about the most stupid thing to do in Notes).

However, the fact that you got a number of very different responses indicates to me, that you didn’t give enough details on what you really want to accomplish. Notes is no relational database, so forget about any concept that’s similar to issuing a new select statement every time a view is used.

Still, there are plenty of ways to customize view behavior for different users. But there is no general option to make views “variable” with respect to anything. If you can be a bit more specific, it should be easy to identify what your best options would be.

Subject: RE: Creating a variable view

Hey Group,

The solution I posted yesterday WORKS. I use it all the time and it works without issue. I use it create views based on @Username - for example:

My Signature Required

My Documents

The user clicks on these views and sees ONLY the docs that fit the criteria in the selection formula using @Username.

You must consider where the username is kept (is it unique or in a string of names).

You can do:

Author = @Username or

@IsMember(@Username, Approvers)

Again -

Create a ‘Shared, private on first use’ view

This option is only available from the ‘New View’ dialog - I don’t believe you can select this attribute from a copy and pasted view or view that already exists.

Set the selection criteria as you want using @Username

The only thing I don’t like about this method is that any view changes will not be visible if a user has already opened the view.

HTH

Good luck

Kevin

Subject: RE: Creating a variable view

mark

Subject: RE: Creating a variable view

Kevin, nobody said it wouldn’t work.

But private views have their shortcomings (and you did mention one already). If the problem can be solved without private views (e.g. using a single category view), I’d always prefer that.

Subject: Creating a variable view

Stephan,

You can easily do this by creating a view using the view type as ‘Shared, private on first use’. You make this selection on the ‘New View’ dialog that appears.

In the view selection formula you can use @Username for this type of view. It will actually create a private view for each user that accesses it and store it for them.

The only warning I will give you is this. Any view updates that are done after the view has been used by the users will not visible to them so make sure the view is the way you want it when you publish it.

HTH

Good luck

Kevin

Subject: Creating a variable view

If all you need to do is select records in a view by user then use an embedded view in a form where the first field is the name of the user and use “show single category”.

In your navigator just use a button @Command([Compose]; @DBname;“Formname”)

It works for small number of lines.

Subject: Creating a variable view

why you don´t use @userroles ?Notes is able to have 75 userroles in the ACL.

So you can fetch all Data in the view maybe with the View selection formula: Select @all

and afterthen you can hide the columns for the specific users with their userroles. i.e. Hide when @isnotmember([xxx];@userroles).

Bernhard