If you have a Lotus Notes database containing a large amount of data (more than 10 GB), searching for a single word or couple of words can take a great deal of time and may not always produce accurate results. This LotusScript code performs the search activity in your Lotus Notes database and replaces the view selection criteria per the search query. This accurately searches your Lotus Notes database and generates a result in just a few seconds.
While working on a project, I came across a Lotus Notes database that had approximately 20 GB of data. One part of the project requirements from the client side was to develop a search functionality with the following criterion:
- Work on multiple search criteria
- Take as little time as possible
- Use a minimal amount of system resources
- Be easy to use
- Display the correct results
The following elements were used in the test environment:
- One Lotus Notes database with a large amount of data (20 GB)
- One search form
- One frameset to show the view
- One view to display the search results by changing the view selection formula
There are nine multi-value fields on the search form. Lotus Notes users can select single or multiple search criteria using these fields.
Once the search criteria is defined on the search form -- after selecting multi-value fields -- the user clicks on the search button. The LotusScript code shown below is placed in that button. When the button is selected, the code written on its click event will be triggered as follows:
- It will declare variables.
- It will create a view selection formula based on the selection of multi-value fields.
- The code will put the search query into an array, remove null values and put "&" after each search criteria.
- Obtain the handle of the view through a back-end object.
- Set the view-selection formula according to the newly created view selection formula from the LotusScript code.
- Open the same view inside the frameset.
Note: These steps will take some time during your initial database search.
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip library by member Niranjan Singh. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes/Domino technical tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.