Areej
asked on
View Selection Criteria
Hello,
I would like to implement a query form that filter the documents based on the criteria the user enters, and display the selected documents in a view.
Is that possible with Notes?
Please note that the query form contains more than 10 fields, and they are optional. i.e. The user can select by one field only or by 10 fields.
Is there a way to specify the view Selection Criteria programatically??
Many Thanks,
Areej
I would like to implement a query form that filter the documents based on the criteria the user enters, and display the selected documents in a view.
Is that possible with Notes?
Please note that the query form contains more than 10 fields, and they are optional. i.e. The user can select by one field only or by 10 fields.
Is there a way to specify the view Selection Criteria programatically??
Many Thanks,
Areej
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here is some Lotusscript code you can use to build the folder:
Dim session As New NotesSession
Dim db As New NotesDatabase("YourServer" ,"YourDire ctory\Your Database.n sf")
Dim dateTime As New NotesDateTime( "12/01/94" )
Dim collection As NotesDocumentCollection
Dim BackFolder As String
Dim UIDb As NotesDatabase
Dim UIDoc As NotesDocument
Set UIDb = session.CurrentDatabase
Set UIDoc = session.DocumentContext
BackFolder = UIDoc.Year(0)
Set collection = db.Search( "Year = '"+BackFolder+"' & (Form = 'Whatever' | Form = 'SomethingElse')",
dateTime, 0 )
Set doc = collection.GetFirstDocumen t
While Not doc Is Nothing
Call doc.PutInFolder( "Year_"+BackFolder+"_Resul ts" )
Set doc = collection.GetNextDocument (Doc)
Wend
REM Print("TEST")
If collection.count >0 Then
Print "[/YourDirectory/YourDatab ase.nsf/De al_"+BackF older+"_Re sults?Open View]"
Else
Print "Sorry, no results found."
End If
UIDoc.BuildFolder = "N"
Call UIDoc.save(True,True)
Now, what I do is I have a scheduled agent that removes the folders each day:
Dim SourceDb As NotesDatabase
Set SourceDb = New NotesDatabase("YourServer" , "YourDirectory\YourDatabas e.nsf")
Forall v In Sourcedb.views
Set view=SourceDB.GetView(v.Na me)
If v.IsFolder Then
'Print "Deleting folder " & v.Name
Call view.Remove
End If
End Forall
Hope this helps,
-Snocross
Dim session As New NotesSession
Dim db As New NotesDatabase("YourServer"
Dim dateTime As New NotesDateTime( "12/01/94" )
Dim collection As NotesDocumentCollection
Dim BackFolder As String
Dim UIDb As NotesDatabase
Dim UIDoc As NotesDocument
Set UIDb = session.CurrentDatabase
Set UIDoc = session.DocumentContext
BackFolder = UIDoc.Year(0)
Set collection = db.Search( "Year = '"+BackFolder+"' & (Form = 'Whatever' | Form = 'SomethingElse')",
dateTime, 0 )
Set doc = collection.GetFirstDocumen
While Not doc Is Nothing
Call doc.PutInFolder( "Year_"+BackFolder+"_Resul
Set doc = collection.GetNextDocument
Wend
REM Print("TEST")
If collection.count >0 Then
Print "[/YourDirectory/YourDatab
Else
Print "Sorry, no results found."
End If
UIDoc.BuildFolder = "N"
Call UIDoc.save(True,True)
Now, what I do is I have a scheduled agent that removes the folders each day:
Dim SourceDb As NotesDatabase
Set SourceDb = New NotesDatabase("YourServer"
Forall v In Sourcedb.views
Set view=SourceDB.GetView(v.Na
If v.IsFolder Then
'Print "Deleting folder " & v.Name
Call view.Remove
End If
End Forall
Hope this helps,
-Snocross
Create an action button with the following code,
@Command([EditSelectAll]);
@Command([RemoveFromFolder ])
Also just in the script include a little bit of code that will check the currrent folder is empty. Just get the first document handle and prompt that the folder has to be cleared.
:-)
@Command([EditSelectAll]);
@Command([RemoveFromFolder
Also just in the script include a little bit of code that will check the currrent folder is empty. Just get the first document handle and prompt that the folder has to be cleared.
:-)
ASKER
Many Thanx.. :-)
ASKER
But how to initialize the folder before moving the documents to it? How to delete the old documents from the folder before copying the new documents?
Many thanx,
Areej