Manage Learn to apply best practices and optimize your operations.

LotusScript button saves time searching large Lotus Notes databases

Searching large Lotus Notes databases is time consuming. This LotusScript code can be placed in a button to quickly perform a search of your Lotus Notes database by replacing the view selection criteria per the search query. Use this method to search large databases in seconds.

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:

  1. Work on multiple search criteria
  2. Take as little time as possible
  3. Use a minimal amount of system resources
  4. Be easy to use
  5. 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:

  1. It will declare variables.
  2. It will create a view selection formula based on the selection of multi-value fields.
  3. The code will put the search query into an array, remove null values and put "&" after each search criteria.
  4. Obtain the handle of the view through a back-end object.
  5. Set the view-selection formula according to the newly created view selection formula from the LotusScript code.
  6. Open the same view inside the frameset.

Note: These steps will take some time during your initial database search.

LotusScript to search large Lotus Notes databases
(Click on code for enlarged view and script download.)

Do you have comments on this tip? Let us know.

This tip was submitted to the 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.

Dig Deeper on LotusScript

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...