Solved

User specific Search and display documents in a view

Posted on 2000-02-23
4
154 Views
Last Modified: 2013-12-18
Hi,

I have a database with a view that displays documents by Date (@created).  There are thousands of documents in the database.

How can I provide a facility for users so that they are able to search by a specific date and Notes will display all documents created BEFORE the specified date in the View.  This will enable the user to view/delete the documents shown?  Answer can be in formula and/or script.  Examples would be appreciated. Thanks.
0
Comment
Question by:ashik1
  • 2
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
Arunkumar earned 150 total points
Comment Utility
Hi Ashik,

You cannot change the view selection formula dynamically.
 
Do the following, Create a folder that will have the same design as that of the view.  Provide a Search button for that folder.

In the button put the following script.
This script would prompt the user for a date and display all the documents created before that date in the folder.

Now you can delete all the documents from this folder.

======================================
Dim ws as new notesuiworkspace
Dim dc as notesdocumentcollection
Dim db As NotesDatabase
Dim ss as new notessession
Dim doc as notesdocument
Dim dateTime As New NotesDateTime( "<<<some old date preferably a date before the db was created>>>" )
Set db = ss.CurrentDatabase

txt = InputBox$("Enter the cutoff date.... ")

 formula = |Form = "<<<FormName>>>" & @Created < "[ & txt & ]"|

Set dc = db.Search(formula , dateTime, 0)

if dc.Count = 0 then
msgbox "No documents found for selected category"
Else
Print "Found " & dc.count & " documents for specified category"
Call dc.PutAllInFolder("<<<FolderName>>>")
Call ws.ViewRefresh
End If


=======================================
Good Luck !

-Arun

PS: Make sure you change the  "<<<>>>" variables in the script.
0
 

Author Comment

by:ashik1
Comment Utility
Hi Arun,

thanks for your help, but I still seem to have problems.  Below is your script with slight alterations.  

* I'm not sure about the NotesDateTime - is the format i entered correct?  i wasn;t sure what date to store.

* I also had to declare var formula. is string okay?

* I have a form called "asbtract".  

* The folder I've created has the first column as a Date field which is sorted and categorized.

     Dim ws As New NotesUIWorkspace
     Dim dc As NotesDocumentCollection
     Dim db As NotesDatabase
     Dim ss As New NotesSession
     Dim doc As NotesDocument
     Dim dateTime As New NotesDateTime( "01/01/95" )
     Set db = ss.CurrentDatabase
     
     Dim formula As String

     txt = Inputbox$("Records displayed before (enter the cutoff date:)")

     formula = |Form =  "abstract"  & @Created <  txt|

     Set dc = db.Search(formula , dateTime, 0) '0 returns all matching documents
     
     If dc.Count = 0 Then
          Msgbox "No documents found for selected category"
     Else
          Print "Found " & dc.count & " documents for specified category"
          Call dc.PutAllInFolder("SpecDate")
          Call ws.ViewRefresh
     End If


The problem is, it keeps telling me that "not documents are found.." when I know for a fact that there are.

What format should I enter the date in the input box?
0
 

Author Comment

by:ashik1
Comment Utility
Arun, I'm very nearly there!

Only one problem - after displaying documents in the folder; if the user does another search, the new search result does not overwrite the previous search results which are still visible in the folder.

  Dim ws As New NotesUIWorkspace
     Dim dc As NotesDocumentCollection
     Dim db As NotesDatabase
     Dim ss As New NotesSession
     Dim doc As NotesDocument
     Dim dateTime As New NotesDateTime( "01/01/95" ) ' Some old date - preferably a date before the db was created
     Set db = ss.CurrentDatabase
     '    
     Dim txt As Variant
     Dim formula As String
     '    
     txt = Inputbox("Records displayed before (enter the cutoff date):")
     formula = "Form = ""abstract"" & date < [" &  txt  &"]"
     Messagebox(formula) ' Remove once testing is completed
     Set dc = db.Search(formula , dateTime, 0)   ' 0 returns all matching documents
     
     If dc.Count = 0 Then
          Msgbox "No documents found for selected category"
          'Call dc.RemoveAllFromFolder("ByUserDate")
          Call ws.ViewRefresh
          Msgbox "No documents found for selected category"
     Else
          Print "Found " & dc.count & " documents for specified category"
          'Call dc.RemoveAllFromFolder("ByUserDate")          
          'Call ws.ViewRefresh          
          Call dc.PutAllInFolder("ByUserDate")
          Call ws.ViewRefresh
     End If
     
0
 
LVL 9

Expert Comment

by:Arunkumar
Comment Utility
Oops !
I forgot to mention that in my code.

This is simple....

Just add the following code before the inputbox statement.

==================================
Dim isdoc as NotesDocument
Dim view as notesview
Set view = db.GetView("SpecDate")
Set isdoc = view.GetFirstDocument

If Not isdoc is nothing then

Messagebox "Please use 'clear view' to clear this view and redo the search."

Exit sub

End if
==================================

Keep an action button called "clear view"
and have the following code in it.

==================
@Command([EditSelectAll])
@Command([RemoveFromFolder])
@Command([ViewRefreshFields])
==================

Good Luck !

-Arun



0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now