Search DominoPower's 11,443 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
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:

lenP = endP-startP

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


« Previous  ·  1  ·  2  ·  3  ·  4  ·  Next »
Other articles you might like
Home > Lotus Technologies > LotusScript (64 articles)
   When the debugger won't debug hidden code that isn't hidden
   What to do if the LotusScript debugger won't single-step over code
   Little known traps about Lotus Notes fields
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Syncing Notes with Android phones
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: Online safety for virtual learning
David Gewirtz Online: CNN commentary and analysis
OutlookPower: Seek and find: Strategies to locate filed-away emails fast
-- 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.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login