|
|
|
|
|
|
|
|
|
|
|
|
|
|
LotusScript agents and the Web (continued)
To begin, we need to get the parameters that were sent to the Agent in the URL. We do this by getting a handle to the QueryString variable [which will contain the entire path of the URL after the question mark (?)] and parsing it to find our parameters.
Set Websession = New NotesSession
Set Webdoc = Websession.DocumentContext
QueryString = Webdoc.Query_String(0)
|
At this point, if we put a Print statement in our code to see what's in the QueryString variable that we just set, it should come back with something like this:
OpenAgent&UNID=11766144EE03AA338525686200504A19&UserN=Chris+Stoner
|
Note that our two parameters are in there as &UNID=11766144EE03AA338525686200504A19 and &UserN=Chris+Stoner.
Next, we need to parse the QueryString for these parameters and set some variables with their values. The Instr function works very well in accomplishing this task.
REM Get Unique ID of Document...
startP=Instr(1, QueryString, "UNID=")+5
|
Here, we've set the variable startP to 15. This was done by using Instr to find the first occurrence of a string within another string (from the Designer Help). Instr will search the given string (QueryString) starting with the given number one (1), and find the first occurrence of the second string (UNID=). It will then return the position number of the first character, which is ten (10), but we really want to get everything AFTER our key, UNID, not including it, so we'll add five (one for each character of UNID and the equal sign) to make it 15. Count from the beginning of QueryString to the 15th character to see where we're starting.
endP=Instr(startP,QueryString,"&")
|
To set the end character, or where we want to stop, we'll use Instr again, and this time we'll start searching at startP and look for the ampersand (&), which will tell us that this parameter is complete and that we're starting a new parameter:
To figure out how long our parameter is, we'll just subtract the end position from the start:
docID=Mid(QueryString,startP,lenP)
|
Then we'll use the MID function to gather all the characters of a given string, QueryString, from the start position, startP, to a given length, lenP.
We'll do the same thing to get the Approver Name, as shown in the following code.
REM get Approver name....
startP=Instr(QueryString, "UserN=")+6
endP=Len(QueryString) +1
lenP = endP-startP
UserN=Mid(QueryString,startP,lenP)
|
Now we'll use Instr and Mid to clean up the Approver's name, since right now we have Chris+Stoner and we really want Chris Stoner.
REM Use UserN to format the UserName to be saved into Approver's Field
startN = Instr(1, UserN, "+")
LenN=Len(UserN)
lastname=Mid(UserN,startN + 1,LenN)
firstname=Left(UserN,startN - 1)
REM Final Formatted Approver Name
frmtName$ = firstname + " " + lastname
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Advertisement --
Find unused Lotus Notes groups and clean up your address book
Have you ever wanted to get rid of old Lotus Notes groups that were cluttering up your address book, but you weren't sure if they were used? Find Unused Groups can help.
Find Unused Groups will check your ACL, mail, multi purpose and server groups to help you determine if they are used, and who uses them.
Learn how to easily clean up your address book. |
-- Advertisement --
Mark your calendar for in-depth Lotus training, May 12-14, Boston
Join experts and peers May 12-14 in Boston for educational and networking events that deliver real-world Lotus training so you can increase productivity and efficiency in your company, advance your skills, and squeeze the most from your current environment. One registration gets you into THE VIEW's Admin2010 and Lotus Developer2010.
Register by April 10 to save $200. |
|
|
|
|
|
|
|
|
|
|