Question : Hi,  I have a lotus notes web application with form fields for user input.  I want to load the field values into xml and then insert the values from the XML file into a DB2 database using lotusscript.

Hi,  I have a lotus notes web application with form fields for user input.  I want to load the field values into xml and then insert the values from the XML file into a DB2 database using lotusscript.

Answer : Hi,  I have a lotus notes web application with form fields for user input.  I want to load the field values into xml and then insert the values from the XML file into a DB2 database using lotusscript.

Hi

You can use the following code to create an HTML file locally.  I'm sure you can just change the HTML tags to XML

Sub Click(Source As Button)

       Dim Session As New NotesSession
      Dim ws As New NotesUIWorkspace
      Dim thisdB As NotesDatabase
      Dim ThisUIDoc As NotesUIDocument
      Dim ThisDoc As NotesDocument
      Dim OfficeDoc As NotesDocument
      Dim OfficeView As NotesView
      
      Set thisdb = session.CurrentDatabase
      Set ThisUIDoc = ws.CurrentDocument
      
      
      
      Set ThisDoc = ThisUIDoc.Document

field1 = ThisDoc.field1
field2 = ThisDoc.field2
field3 = ThisDoc.field3
field4 = ThisDoc.field4
field5 = ThisDoc.field5
      ' Create a file
      Dim text As String
      Dim fileNum2 As Integer
      fileNum2% = Freefile()
      
      FileLocation = "c:\XML\"
      
      
      FilePath = FileLocation & "export.xml"
      
      Open FilePath For Output As fileNum2%            
      
      
      Print #filenum2% , "<html> "
      
      Print #filenum2% , "<body>"
      
      Print #filenum2% , "<table border=0 width="300">"
      Print #filenum2% , "<tr>"
      Print #filenum2% , {<td width="200">}
      Print #filenum2% , {<p style="margin-top: 0; margin-bottom: 0">}
      Print #filenum2% , {T: } & field1(0) & "<br>"
      Print #filenum2% , {F: } & field2(0)&"<br>"
      Print #filenum2% , {F: } & field3(0)&"<br>"
      Print #filenum2% , {F: } & field4(0)&"<br>"
      Print #filenum2% , {F: } & field5(0)&"<br>"
      Print #filenum2% , "</tr>"
      Print #filenum2% , "<tr>"
      Print #filenum2% , {<td width="200">}
      Print #filenum2% , {<img border="0" src="} & uselogo & """ width="195" height="68"></td>"
      Print #filenum2% , "</tr>"
      Print #filenum2% , "</table>"
      Print #filenum2% , "</body>"
      Print #filenum2% , "</html>"
      
      
'Close the file
      Close fileNum2%
End Sub
      

You can atually "speak" directly with the DB2 database via Lotus Script.  This is supported from R8.  I'm sure there are other ways also to write code that will access the DB2 database directly.

Cheers
      
Random Solutions  
 
programming4us programming4us