Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

User specific Search and display documents in a view

Posted on 2000-02-23
4
Medium Priority
?
162 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 600 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

879 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