Pass variables to LotusScript agent via URL


LotusScript


Function SplitQueryString(strValue As String) As Variant
	On Error Goto SplitError
  	'Takes entire query string from URL and splits it into logical values
	Dim intAmpPos As Long, intEqPos As Long, intPos As Long
	Dim intCount As Long
	Dim varResults() As String
	
  	'init vars
	intAmpPos = 1
	intEqPos = 1
	intPos = 1
	
	While intAmpPos <> 0
		Redim Preserve varResults(intCount)
		intEqPos = Instr(1, strValue, "=") + 1
		intAmpPos = Instr(intEqPos, strValue, "&")
		If intAmpPos = 0 Then
			varResults(intCount) = Right(strValue, Len(strValue)-intEqPos+1)
		Else
			varResults(intCount) = Mid(strValue, intEqPos, intAmpPos-intEqPos)
		End If
		strValue = Right(strValue, Len(strValue)-intAmpPos)
		intCount = intCount + 1
	Wend
  	'return values as variant array
	SplitQueryString = varResults
	Exit Function
SplitError:
  	'in the case of an error, reset value to nothing
	SplitQueryString=""
	Exit Function
End Function

Calling the function

varQueryString = SplitQueryString(doc.Query_String_Decoded(0))
Print "hello" & varQueryString(0) & varQueryString(1) & varQueryString(2)

Written by Frank Joseph Brefere III

Posted by fbrefere001 on Friday March 27, 2009