Email:   
Home
In This Issue
Email a Friend
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.
Sorting documents via Notes and the Web (continued)

The postman
The $$ViewTemplate form is the key for gathering the information collected from the radio button and checkboxes of the form and sending this information to the "catcher" form. This is all accomplished through the form post command as shown in the code below:

[<form method="post" action="http://206.68.64.25/web/Velasco/sortdb2.nsf/MovieSortAgentForm?CreateDocument";>]

The above URL can be broken down in the following manner:

[<form method="post" action = "http://"; + base URL + "/" + filename (with subdirectory info) + "/" + name of form to capture data + "?CreateDocument">]

As with most HTML tags, be sure to insert a closing </form> tag right after the submit button for the form. You can see an example of what all of this looks like in Figure B.

FIGURE B

Here is $$ViewTemplate form that has the form post command in it. Click picture for a larger image.

Stairway to Heaven
As I mentioned above, the "catcher" form is the form that captures information about the document to be moved and what direction it should be moved. You can see a screen shot of what this form looks like in Figure C.

FIGURE C

The catcher form catches all of the information needed to run the agent. Note the formula that determines which agent to run based on the direction selected. Click picture for a larger image.

Moving
Here is the MoveUpDocWeb agent that enables the selected document to be moved up. This is very similar to the code for the MoveDownDocWeb agent. You can find both of these agents in the sample database at http://dan.velasco.com.

Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase

Dim moveUpDoc As NotesDocument
Dim reSortDoc As NotesDocument
Dim note As NotesDocument
Dim sortCollection As NotesDocumentCollection

Set db = session.CurrentDatabase
'--Use the DocumentContext property of the session class to get a handle on the "catcher" document
Set note = session.DocumentContext

'--Get a handle on the document that was selected to move down.
Set moveUpDoc = db.GetDocumentByUNID(note.DocUNID(0))

'--Find out if the old number is equal to one and exit the sub if that is the case
'--If you like, you can re-direct the user to an error screen but this is really idiot-proofing the application
If oldNumber% = 1 Then
Exit Sub
Else
'--Set the old and new number variables
oldNumber% = moveUpDoc.Sort_Number(0)
newNumber% = oldNumber% - 1
End If

'--Set the search parameters so you sort documents with same form.
'--If the document has a value in the Sort_Category field, limit documents to resort to matches.
form$ = moveUpDoc.Form(0)
sortCategory$ = moveUpDoc.Sort_Category(0)

If sortCategory$ = "" Then
search$ = "Select Form = " + """" + form$ + """" + ""
Else
search$ = "Select Form = " + """" + form$ + """" +" & Sort_Category = " + """" + sortCategory$ + """" + ""
End If

Dim dateTime As NotesDateTime
Set dateTime = New NotesDateTime("1/1/90")
Set sortCollection = db.Search(search$, dateTime, 0)

'--Go through documents in collection and find the document with the new number and replace it with the old number
Set reSortDoc = sortCollection.GetFirstDocument

Do While Not(reSortDoc Is Nothing)
If reSortDoc.Sort_Number(0) = newNumber% Then
reSortDoc.Sort_Number = oldNumber%
Call reSortDoc.Save(True, True)
Exit Do
Else
Set reSortDoc = sortCollection.GetNextDocument(reSortDoc)
End If
Loop

'--Now, increase the number of the selected document by one to move it down
moveUpDoc.Sort_Number = newNumber%
Call moveUpDoc.Save(True, True)




[ Prev | Next ]

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
-- Advertisement --

PistolSTAR: the de facto standard for Lotus authentication
PistolStar's Password Power integrates with Microsoft Active Directory to enable single sign-on to Lotus applications and automatic recovery of the Notes ID password via self-service reset of the Active Directory password.

  • A single set of credentials to remember - one set of password policies to manage.
  • Cost-effective plug-ins integrate smoothly with your environment.
  • Proven, ground-breaking technology deployed to millions of users.


Learn more.
-- Advertisement --

Six Great Tools for IBM Lotus Sametime
  • Encrypted and secure, browser-based, persistent chat rooms
  • Complete chat logging and auditing
  • Easy-to-define IM help desk queues
  • Manage buddy lists across any organization
  • Integrate awareness into Microsoft Outlook
  • High powered, rapid bot development tools


Visit Instant Tech for free trials and more information.
Copyright © 1998-2009, ZATZ Publishing. All rights reserved worldwide.
Editor's Login