Manage Learn to apply best practices and optimize your operations.

Extract value pairs from text arrays with LotusScript

Use this LotusScript code to extract value pairs from a text array. In this example, see how various Work Flow status stages were extracted and summarized, allowing the results to be more easily analyzed.

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
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 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.

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 ...