Solved

User specific Search and display documents in a view

Posted on 2000-02-23
4
155 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
ID: 2549874
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
ID: 2550638
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
ID: 2551490
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
ID: 2553927
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 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

22 Experts available now in Live!

Get 1:1 Help Now