Manage Learn to apply best practices and optimize your operations.

Extracting query string parameters in agents

This code will produce a LotusScript list of key value pairs representing the query string passed to the agent in the form

This code will produce a LotusScript list of key value pairs representing the query string passed to the agent in the form:-


The list will allow you to extract these parameters like this:

lstParams( "fred" )
IsElement( lstParams( "bedrock" ) )

The code uses the LotusScript Evaluate command to process the QUERY_STRING_DECODED and make it into an array. It is very simple to understand and because it uses the QUERY_STRING_DECODED there is no need to decode the string as Domino does this for us!

The keys for the list are converted to lowercase as it is easy to pass parameters that are in the wrong case. The case of the values is left unaltered.

To call the function, use the code in the Initialize sub.

sub Initialize
	Dim session As New NotesSession
	Dim docCurrent As NotesDocument
	Dim lstParams As Variant
	lstParams = funGetQueryParameters( docCurrent.QUERY_STRING_DECODED(0) )
	Forall sValue In lstParams
		Print Listtag( sValue ) & "=" & sValue & "<br>"
	End Forall
End Sub

Function funGetQueryParameters( sQueryString As String ) As Variant

Given the QUERY_STRING_DECODED, return a string list containing key value pairs

	Const FORMULA_EXPLODE_QS_2 = |";"&")|
	Const FORMULA_EXPLODE_PAIR_2 = |";"=")|
	Dim lstParams List As String
	Dim vAllPairs As Variant
	Dim vPair As Variant
	vAllPairs = Evaluate( FORMULA_EXPLODE_QS_1 & sQueryString & FORMULA_EXPLODE_QS_2 )
	Forall sPair In vAllPairs
		vPair = Evaluate( FORMULA_EXPLODE_PAIR_1 & sPair &
FORMULA_EXPLODE_PAIR_2 ) 'The line below catches the situation where there is no
pairing, ie just a single 'key name with no value. In this case the key and value are the same lstParams( Lcase(vPair(0)) ) = vPair( Ubound( vPair ) ) End Forall funGetQueryParameters = lstParams End Function
This was last published in May 2002

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.




  • 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 ...