Creating a Notes form dynamically

I always wanted to create a Notes form dynamically -- with labels and fields, using LotusScript. I realized that using XML with Lotus Notes R6 was the answer: XML for Lotus = DXL.

You can use DXL technology for both exporting and importing Notes design elements. See the R6 Design Help database for an example of exporting design elements (see CreateDXLExporter method). The DXL file exported all database designs, not just a single design element!

The tricky part was importing just a form design definition consisting of labels and text fields (no fancy formatting only bold labels). Studying an exported DXL file, I finally I found the right DXL file for a simple form definition --a file I can use with .CreateDXLImporter method.

Here is a sample DXL file:

<?xml version='1.0' encoding='utf-8'?>
 <!DOCTYPE form SYSTEM 'domino.dtd'>
 <form name='CDAO-64TLV5' xmlns=
'http://www.lotus.com/dxl' version='1.01'>
  <pardef id='1'>>
  <par def='1'/>

<par><run><font style='bold'/>
My label 00:
<par><field type='text' kind='editable' 
<par><run><font style='bold'/> 
My label 01:
<par><field type='text' kind='editable' 
<par><run><font style='bold'/> 
My label 02:
<par><field type='text' kind='editable' 
<par><run><font style='bold'/> 
My label 03:
<par><field type='text' kind='editable' 


The structure of the sample DXL is rather simple:

Label nn:
[textfield nn]

Below is how to import the above DXL file in R6 using LotusScript.

I suggest you:

  • Pay attention to the DXL import file (no blank line at the top of the file, open/close XML tags, etc.).
  • Study a DXL database output to see how Notes and text fields are translated in XML (bold, field types).
Sub importDXL(filedxl As String)
 On Error Goto myerror
 Dim stream As NotesStream
 Set stream = sess.CreateStream
 If Not stream.Open(filedxl) Then
  Msgbox " importDXL() - Error importing file " 
& filedxl 
  Exit Sub
 End If
 If stream.Bytes = 0 Then
  Msgbox "File does not exist!" & filedxl
  Exit Sub
 End If
 Dim importer As NotesDXLImporter
 Set importer = sess.CreateDXLImporter
(stream, db)
 importer.ReplaceDBProperties = True
 = False
 importer.ACLImportOption = 
 importer.DesignImportOption = 
 Call importer.Process
 Exit Sub
 Msgbox "importDXL() - " & Err & " -
 " & Error & " code line: " & Erl
 Exit Sub
End Sub

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

This tip was submitted to the SearchDomino.com tip exchange by member Cristian D'Aloisio. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

This was first published in September 2004

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

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.