Select documents for view by login

Can anybody help me, please?I need select documents for view by login.

So, I’m using string for View Selection:

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

Where Field “IsponSearch” contains login of user. Type of this field “Authors | Computed”.

(“Computed” - bacause I get it from another database(this part work correct)).

So, when I open this view first time, I see only my documents(works correct),

but other users doesn’t see anything, or see my document and their documents(doesn’t work correct).

So, why it doesn’t work correct everytime? Whats wrong?

Subject: Select documents for view by login

Instead of using shared views, set the views to ‘Shared, private on first use’.

You will then be able to use @UserName in the view selection formula.

It’s wise to clean up the private views on exiting the database to ensure that they are up to date with the latest information.

I use the following code for this:

Declarations:

Const APIModule = “NNOTES” ’ Windows/32 only

Const NOTE_CLASS_VIEW= &H0008

Declare Function OSPathNetConstruct Lib APIModule Alias “OSPathNetConstruct” _

( Byval NullPort As Long, Byval Server As String, Byval FIle As String, Byval PathNet As String) As Integer

Declare Function NSFDbOpen Lib APIModule Alias “NSFDbOpen” _

( Byval PathName As String, DbHandle As Long) As Integer

Declare Function NSFDbClose Lib APIModule Alias “NSFDbClose” _

( Byval DbHandle As Long) As Integer

Declare Function NIFFindPrivateDesignNote Lib APIModule Alias “NIFFindPrivateDesignNote” _

( Byval hdb As Long, Byval NoteName As String, Byval NoteClass As Integer, NoteID As Long ) As Integer

Subroutine:

Sub DeletePrivateView(db As NotesDatabase, vname As String)

Dim p$

’ To open a Domino database on a server, use this function to create

’ the full path specification, and pass this specification as input to NSFDbOpen

’ or NSFDbOpenExtended.

p$ = String(1024, " ")

OSPathNetConstruct 0, db.Server, db.FilePath, p$ 

’ This function takes a pathname to an existing Domino database or database

’ template (whether on a Lotus Domino Server or a local database), opens the

’ database, and returns a handle to it. All subsequent access to the database is

’ carried out via this handle. Use NSFDbClose to close the database file handle

’ and deallocate the memory associated with it.

Dim hDB As Long

NSFDbOpen p$, hDB

’ Given the name and NOTE_CLASS_xxx of a private design note (form, view,

’ folder, helpindex, macro, field, or replication formula ), this function returns the note ID.

’ Uses the View or Folder name passed to it - vname.

Dim retNoteID As Long

Dim result As Integer

result = NIFFindPrivateDesignNote(hDB, vname, NOTE_CLASS_VIEW, retNoteID)

'If result is anything other than 0, the Private Design Note could not be found

If result = 0 Then

	Dim doc As NotesDocument

’ Get the Private View or Folder by its NoteID

	Set doc = db.GetDocumentByID( Hex$(retNoteID) ) 

	Call doc.Remove( True )

	Print "Removing : " & vname

End If

’ This function closes a previously opened database.

NSFDbClose hDB

End Sub

You can then call the DeletePrivateView subroutine, passing it the database and the name of the view to delete.

Hope this helps.

Subject: Select documents for view by login

Hi,

the solution for this issue is as follows:

  1. Dont give any formula for the view just get all the documents, but the first column should have the names of people (From that current users document will be selected).

  2. Create a new form and embedd that view in to this form.

  3. Now go to the objects on the left side there u will have the embedded view, for this there will be an object Show Single Category.

  4. Click on Show Single Category and give the formula @Name([CN];@username).

this will solve your problem.