Manage Learn to apply best practices and optimize your operations.

Quickly parse URL parameters

Tired of cutting out ParentUNID and Count Start when submitting a page from browsers? This function makes a list of parameters and their corresponding values, if any.

View member feedback to this tip.

I got tired of cutting out the ParentUNID and Count and Start parameters from a URL when submitting a page from browsers. So I came up with this LotusScript function named "makeParams()" to make a list of parameters and their corresponding values, if any. The parameter can be accessed from the list in LotusScript by using the format paramlist("ParentUNID").

I've also provided this function in JavaScript below, too. (I tested it on Internet Explorer though, so I'm not sure how it'll work on Netscape, Opera, Mac, etc.) You can access the JavaScript list using paramlist["ParentUNID"].

LotusScript code:

Function makeParams()
'Better that paramlist is declared in 
(Declarations) by: Dim paramlist list as
'If you declare it here, the list dies when 
the function looses scope
 Dim paramlist list as String
 Dim arg As Variant
 Dim parts As Variant
 arg = Evaluate({ @explode
( Query_String ; "&") }, doc)
 Dim tempdoc As notesdocument
 Set tempdoc = 
 Forall params In arg
  tempdoc.params = params
  parts = Evaluate( {@explode
( params ; "=" )} , tempdoc)
  If Ubound( parts ) = 1 Then 
   paramlist(parts(0)) = parts(1)
   paramlist(parts(0)) = ""
  End If  
 End Forall

' To test for a parameter use  IsElement 
( listName ( stringExpr ) )

If ( IsElement(paramlist("parametername") ) 
  'Then the string  <parametername> 
was in the URL

  'If it had a value associated with it then 
accessing the list 
  'with the string <parametername> 
will return the associated value
  'If you just included a parameter in the 
URL like  <&responses>
  'then just finding the string <&responses>
 is useful by itself.
  'For instance if 
  'Calling <paramlist("ParentUNID")> 
returns the UniversalID 333...853
  'To check to see if responses is in the url 
IsElement tells you that
End If

End Function

JavaScript code:

paramlist = new Array();
contextlist = new Array();
splitReturn = locationHREF.split
(new RegExp("&","g"));
  for (paramNum in splitReturn) {
  parts = splitReturn[paramNum].split("=");
  if ( 2 == parts.length ) { 
   paramlist[parts[0]] = parts[1];
  } else {
   paramlist[parts[0]] = "";

// If you try to get the value of a 
Non-parameter it returns null
 if ( null==paramlist ["notaparameter"] ){
  alert("Not a param");
  alert("Is a param");


Domino 6 has a command called @UrlQueryString that may be easier to use. Presumably it works with the LotusScript Evaluate command if you need to use it in LotusScript.

—Mark B.


I think it's also worth pointing out that ND6 foregoes the need for any of this using the @URLQueryString function. Also, users can then use split and join in LotusScript rather than an Evaluate and @Explode.

I have found that I've had to rewrite code like these functions as they don't cater for characters such as quotation marks being passed in via the URL, and this effectively breaks the LotusScript as the @Explode can't cope. Of course, there are workarounds, but if you have ND6 you don't need to bother!

—Giles H.


Re: LotusScript version

You can use the Split function for this. The code doesn't "URL decode" the parameters, so it will fail with values that contain spaces, "&" or other characters that can't appear or have special meaning in the URL.

Portions of the parameter value to the right of an "=" are lost -- e.g., "&Equation=e=m*c^2" would only see the value "e."

Andre Guirard

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

This tip was submitted to the tip exchange by member Sean Haggerty. 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.

Dig Deeper on LotusScript



  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury