Manage Learn to apply best practices and optimize your operations.

A flexible data export agent for Lotus Notes contributor Chuck Connell provides a LotusScript data export agent that allows Lotus Notes users to define any number of their own export configurations (field lists and output files) -- without programming.

Two years ago, I published a tip called "Putting an end to the frustration of mail merge" that showed how to export data from Lotus Notes to Microsoft Word. I included a sample Microsoft Word document that showed how to use the exported data during a mail merge. I also noted that the same Lotus Notes export agent code works unchanged with Microsoft Excel. Since that time, this has been one of my most popular articles, earning me a reader rating of 4.6 out of 5.

But as I've applied this export agent method within my own work for customers, I've discovered some limitations. Suppose you want to add another export choice that sends a different set of fields to Microsoft Word? You can do this with my older example, but you have to use Domino Designer to create another copy of the export agent. Many Lotus Notes shops simply don't have Domino Designer.

Or suppose you want 10 different kinds of exports for varying situations? In my earlier example, this would get ugly, since you would need 10 nearly identical copies of the export agent.

A solution to these problems would be to allow users to define any number of their own export configurations (field lists and output files) without programming. Such a solution is presented here with a new downloadable sample called "Flexible Data Export from Notes. This time, I've also included an R5 version of the sample right from the start, since I always get that request.

The key new feature in this example is a user-configurable setup view that contains a variable number of Lotus Notes export definitions. Each export definition has a name, and users can choose the style of export from a picklist of these names.

After opening the sample Lotus Notes database, notice that there are two Admin views. The view Admin/Settings is simply a holder for configurable picklists, such as name prefixes. This view is restricted to users with the [Settings] role, so you can control which users may modify application picklists. (There is another hidden view of the picklists that is open to all, so users can see the picklists when creating a document.)

The view Admin/Exports contains the list of export configurations that are key to this sample. This view is also restricted to users with the [Settings] role and also has a matching hidden view to allow all users to see the export choices at runtime. Each export configuration contains:

  • The name of the export.
  • The default filename used for the exported data.
  • A switch that controls whether the export emits a header row with field names. The switch can be either "Header" or "No Header."
  • The list of Lotus Notes field names to be exported when the user chooses this kind of export.
  • A description of the export, which appears in this view.

Within the Lotus Notes export agent, the LotusScript code presents users with the list of export choices found in the Admin/Exports view, by using the command:

NotesUiWorkspace.PickListStrings(PICKLIST_CUSTOM, False, 
ThisDb.Server, ThisDb.FilePath,  EXPORT_VIEW_NAME, "Export List", 
"Please select an export choice...", 1)

The result of all this is that designated users -- with the [Settings] role -- can create new export choices within an application, with a name of their choosing. Each export choice can be completely configured, with its own default output file, header row option and field list. There can be any number of export choices, each of which takes up very little space in the Lotus Notes database.

To test the downloaded sample:

  1. Select some documents in view #1, pull down the command Actions -> Export Data.

  2. Select one of the export choices, and then follow the other prompts.

  3. Test the configurability by modifying (or adding) to the export choices in the Admin/Exports view.

  4. Run the export again.

To create a new document within the Settings or Export views, copy and paste an existing document with Ctrl-C/Ctrl-V.

About the author: Chuck Connell is president of CHC-3 Consulting, which helps organizations with all aspects of Lotus Notes and Domino.

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

Related information from

  • Expert Advice: Exporting data from Microsoft Excel to Lotus Notes
  • Expert Advice: Importing data from a text file into a Lotus Notes calendar
  • Tip: Exporting email from Lotus Notes to .EML messages
  • Tip: Creating Microsoft Word documents from Lotus Notes

    Please let others know how useful this tip is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our tip contest and you could win a prize.

  • Dig Deeper on Lotus Notes Domino Agents

    • Favorite iSeries cheat sheets

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

    • HTML cheat sheet

      This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

    • Carol Woodbury: Security

      Carol Woodbury