Not Forum Friday, but Usenet Tuesday. :-) A user in comp.groupware.lotus-notes.programmer had a question about generating Notes document remotely/in an automated way from another web application, using Perl:
> We have a Lotus Notes application and we would like to automate
> creating a new document or record in that application from another web
> based application.
>
> Here are the details:
> User action on web application triggers a PERL script to create a new
> record (document) in Lotus Notes (or Domino).
Here is my suggestion:
Public url As String
Private params List As String
Public Sub New()
Dim session As New NotesSession
Dim doc As NotesDocument
Set doc = session.DocumentContext ‘ Document with all CGI variables
‘ Check if HTTP GET or POST was used…
If Instr(doc.Query_String(0),"&") > 0 Then ‘ GET was used
url = doc.Query_String(0)
Elseif Instr(doc.Request_Content(0),"&") > 0 Then ‘ POST was used
url = "&" & doc.Request_Content(0)
Else ‘ No parameters
Exit Sub
End If
End Sub
Public Function GetParams() As Variant
Dim offset As Integer
Dim startpos As Integer
Dim midpos As Integer
Dim endpos As Integer
Dim nextpos As Integer
Dim dataname As String
Dim datavalue As String
startpos = Instr(url,"&") ‘ Start of first parameter
Do While Not startpos = 0
nextpos = Instr(startpos+1, url, "&") ‘ Start of next parameter
If nextpos = 0 Then ‘ We reached the end
endpos = Len(url)+1
Else
endpos = nextpos
End If
midpos = Instr(startpos+1, url, "=")< /font> ‘ Position of = character
dataname = Mid$(url,startpos+1,midpos–startpos–1) ‘ Get name
datavalue = Mid$(url,midpos+1,endpos–midpos–1) ‘ Get value
params(dataname) = datavalue ‘ Add value to list
startpos = nextpos ‘ Set new start position
Loop
GetParams = params
End Function
End Class
Here is a sample agent that uses the class and print the arguments to the browser. Just expand on that code to create the document in the database:
Option Declare
Use "URL.class"
Sub Initialize
Dim url As New URLclass
Dim params As Variant
params = url.GetParams()
Forall x In params
Print Listtag(x) & " = " & params(Listtag(x)) & "<br>"
End Forall
End Sub
provided by Julian Robichaux at nsftools.com.