Parsing URL Parameters Simply

One of my projects required sending of some parameters to documents or agents via URL. I didn't want to write some...

long code and even I wanted to reuse it in script and with minor changes in formulas, if possible.

Code for LS:

Dim Session As NotesSession
Dim Doc As NotesDocument

Dim Prms, Nms, Vls

Sub ParseQueryParams(S, Params)
' Function simply parses 
' string delimited by '&' into
' vector of values in form

Params = Evaluate("@Explode(@Right(""" & S & """; ""&""); ""&"")")
End Sub

Sub ParseQueryParams_NameValue(S, Names, Values)
' Function simply parses 
' string delimited by '&' into
' 2 vectors of names
' and values

Names = Evaluate("@Word(@Explode(@Right(""" & S & """; ""&""); ""&""); ""=""; 1)")
Values = Evaluate("@Word(@Explode(@Right(""" & S & """; ""&""); ""&""); ""=""; 2)")
End Sub

Sub Initialize
Set Session = New NotesSession

' Following row will get Document
' which is passed to agent
Set Doc = Session.DocumentContext
' Following row processes
' Query_String_Decoded CGI variable
' passed to agent
' and returns vector 
Call ParseQueryParams(Doc.Query_String_Decoded(0), Prms) 

' Following row processes
' Query_String_Decoded CGI variable
' passed to agent
' and returns 2 vectors 
' with names and values
Call ParseQueryParams_NameValue(Doc.Query_String_Decoded(0), Nms, Vls) 

End Sub

When it's required to parse parameters in document, it's possible to parse parameters accordingly in formulas (note that Query_String_Decoded field of text type, even computed for display, MUST exist in form:

Parameters := @Explode(@Right(Query_String_Decoded; "&"); "&"); ParamNames := @Word(Parameters; "="; 1); ParamValues := @Word(Parameters; "="; 2);

This was first published in February 2001

Dig Deeper



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:




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...