I have a button in a form (simple start/end date pickers + search button) and am trying to open a view with search results based on start and end dates. When the button is clicked, it seems to do something then nothing happens. I even tried the same formula in a view and set the value to a text string (does same thing). My 1st attempt was using a form with an embedded view… no luck (thanks to Andre for his assistance). I’m just trying (form, view, normal search template…) to find an option so users can enter a start and end date and see results of all documents in the date range. My current script is below:
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim view As NotesView
Set view = db.GetView( "Reports Lookup" )
dateQuery = "[ReportDate] >= " & ReportStartDate & " and [ReportDate] <= " & ReportEndDate
count& = view.FTSearch(dateQuery, 0)
Subject: RE: FTSearch & Action Button (No Results)
The free download that accompanies this article may be of help: Views Part 1: User-Based Views and Query Assistant. It shows several ways to do what you’re doing.
Also, version 8.0 supports initiating a full-text search in a view that’s a component of a composite app.
Subject: RE: FTSearch & Action Button (No Results)
I like the view article… am a vertebrate paleontology fan! The “Search Dialog” seems perfect… has the date range + other options. I have not reviewed the code but is there any way to hide the search bar? It appears with the search query when you enter the requirements and hit OK in the dialog box.
update: I moved the form + scriptlibs/agents to my test database and am encountering a problem. I get an error (mentions line 13) that says dialogbox cannit be used in this content and that a document must be selected. Any ideas?
Subject: RE: FTSearch & Action Button (No Results)
I corrected the problem (incorrect form reference). FYI… when I try to use the comma-separated “list” option, the query syntax is generated like below:
([ReportSales] = (1111 or 1234))
This generates a “query not understandable” error message. When I change to the following it works fine. Could this be something different with the V8 client? …looks like The View article was in 2004.
([ReportSales] = (1111)) or ([ReportSales] = (1234))
Do I need to use openview instead of getview? Thanks team…
I get the desired results if the “Search This View” menu option is used (hit date button and choose if between…). I’m trying to keep users from accessing this search and instead use a simple form with start and end date fields + a button.
Your code is simply returning the number of docs that a search on this view would return. If you want to do anything with them you have to add to your code.
The problem is, you can’t update the current view with these documents.
You could put them in a folder and open that folder for the user, although this would have to be a private folder of course.
If this is for the web then you could run this in an agent and output the results as HTML.
Subject: RE: FTSearch & Action Button (No Results)
Thanks Dan… it is hard to believe that I cannot insert the search query text (e.g. dateQuery = “FIELD ReportDate >= " & query1$ & " and FIELD ReportDate <=” & query2$). query1$ and query2$ are values from input boxes. I thought the db.FTSearch( dateQuery, 0) would open the search view. Maybe I can create a report form and have it build the data into a field on the form.