« Return to the main article
Here is a LS routine I have been using.
Option Public
Public nSession As NotesSession
Public naCurrent As NotesAgent
Public ndbCurrent As NotesDatabase
Public ndocCurrent As NotesDocument
Public ndocUser As NotesDocument
Public vURLParams List As String
Sub Initialize
Set nSession = New NotesSession
Set naCurrent = nSession.CurrentAgent
Set ndbCurrent = nSession.CurrentDatabase
Set ndocCurrent = nSession.DocumentContext
Call ParseURL
End Sub
Sub ParseURL
On Error Goto CommomErrHandler
Dim vURL As String
Dim vPairs As Variant
Dim vLabel As String
Dim vData As String
vURL = ndocCurrent.Query_String(0)
vPairs = Split(vURL,"&")
Forall vItem In vPairs
vDelimiter = Instr(vItem,"=")
If vDelimiter > 0 Then
vLabel = Left(vItem,vDelimiter-1)
vData = Mid(vItem,vDelimiter+1)
Else
vLabel = Left(vItem,vDelimiter)
vData = ""
End If
vURLParams(vLabel) = vData
End Forall
Exit Sub
'treats commom errors
CommomErrHandler:
'This line displays in browser
Print "Got error on (" + naCurrent.Name + "-ParseURL) #" + Cstr(Err) + " - " + Error$ + " on line " + Cstr(Erl)
'This line displays on the Domino server console & logs
Msgbox "Got error on (" + naCurrent.Name + "-ParseURL) #" + Cstr(Err) + " - " + Error$ + " on line " + Cstr(Erl)
You can then recall any of the args simply by value = vURLParams("argname")
e.g. url = htt://server/db.nsf/agent?OpenAgent&city=Boston
you get the city by city = vURLParams("city")
Here is a LS routine I have been using.
Option Public
Public nSession As NotesSession
Public naCurrent As NotesAgent
Public ndbCurrent As NotesDatabase
Public ndocCurrent As NotesDocument
Public ndocUser As NotesDocument
Public vURLParams List As String
Sub Initialize
Set nSession = New NotesSession
Set naCurrent = nSession.CurrentAgent
Set ndbCurrent = nSession.CurrentDatabase
Set ndocCurrent = nSession.DocumentContext
Call ParseURL
End Sub
Sub ParseURL
On Error Goto CommomErrHandler
Dim vURL As String
Dim vPairs As Variant
Dim vLabel As String
Dim vData As String
vURL = ndocCurrent.Query_String(0)
vPairs = Split(vURL,"&")
Forall vItem In vPairs
vDelimiter = Instr(vItem,"=")
If vDelimiter > 0 Then
vLabel = Left(vItem,vDelimiter-1)
vData = Mid(vItem,vDelimiter+1)
Else
vLabel = Left(vItem,vDelimiter)
vData = ""
End If
vURLParams(vLabel) = vData
End Forall
Exit Sub
'treats commom errors
CommomErrHandler:
'This line displays in browser
Print "Got error on (" + naCurrent.Name + "-ParseURL) #" + Cstr(Err) + " - " + Error$ + " on line " + Cstr(Erl)
'This line displays on the Domino server console & logs
Msgbox "Got error on (" + naCurrent.Name + "-ParseURL) #" + Cstr(Err) + " - " + Error$ + " on line " + Cstr(Erl)
End Sub
You can then recall any of the args simply by value = vURLParams("argname")
e.g. url = htt://server/db.nsf/agent?OpenAgent&city=Boston
you get the city by city = vURLParams("city")