Extract value pairs from text arrays with LotusScript

A client recently asked me to compose a system for extracting value pairs from text arrays so the company could analyze the amount of time Lotus Notes documents spent in various Work Flow status stages. They thought this method would help to better analyze the results.
Related resources from SearchDomino.com:
Mass-input form uses LotusScript to ease large-scale moves

Code exports Lotus Notes data to an OpenOffice Calc spreadsheet

Code a stack trace into LotusScript libraries for error handling

However, because the status history was only available in a text array, there was a problem. The Lotus Notes documents could spend an undetermined amount of time in any status more than one time. The variety and number of status stages precluded the use of multiple-type double variables. The status stages also held time values.

This addition of new status stages meant that I would also need to rewrite the LotusScript code. Because most documents used just five or six of the 16+ available statuses, that would waste too much time and the code would be extremely complicated.

Here is a sample of the text array:

Example of text array
(Click on code for enlarged view.)

The solution was to extract the data into a list using the status as the list tag:

LotusScript to summarize results
(Click on code for enlarged view and script download.)

This method did everything the client wanted -- quickly and accurately. Additionally, because I only used 22 lines of code, it's easy to understand and debug.

Combination of text array and LotusScript code
(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 SearchDomino.com tip library by member Jack Swalwell. 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.

This was first published in March 2009

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.