Search DominoPower's 11,437 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.
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. Roll over 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. Roll over 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)


« Previous  ·  1  ·  2  ·  3  ·  4  ·  Next »
Other articles you might like
Home > Lotus Technologies > Notes (84 articles)
   A walk down Memory Lane with Lotus Notes
   An application for scanning physical mail and distributing it virtually
   Managing Notes deployments with Teamstudio Build Manager
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
Home > Tips & Techniques (102 articles)
   More about Domino log files
   Why your log.nsf might not be purging properly
   A faster way to repair corrupted server files
Home > Lotus Technologies > Application Development (48 articles)
   An application for scanning physical mail and distributing it virtually
   How hide-whens in Rich Text can ruin your whole day (and what to do about it)
   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
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
2010: A Lotusphere of change
Latest Lotus Headlines
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
Adding Quick Highlighter support to IBM Lotus Notes Domino Wiki, Weblog, or Webpage
Remember Young Admins...there are 2 files
WebSphere Portal 6.1.0.2 and Lotus Domino 8.5
The CKEditor - with Domino
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- Advertisement --

Sophisticated Meets Simple For Document Management
Share. Control. Manage.
Documents, emails, and content in the context of how work is done. Native to Lotus Domino. The User Experience unseen for Lotus Domino. Do more with less. Really.

See the possibilities Docova unleashes for Lotus Domino.
-- Advertisement --

Integrate your Notes Applications with Microsoft Office and Symphony
Integra for Notes Integrates Microsoft Office and/or IBM Lotus Symphony
Requires NO change to the design of the appliation or Installations of DLL's and EXE's
  • Integra is a ready to use solution, enhance static reports with Excel data analysis, pivot tables, macros
  • User friendly aproach, using a point and click access to features
  • Reports from any Lotus Notes databases
  • Runs reports through a Notes client, web browser and scheduled basis
  • Allows use of LotusScript for advanced data manipulation
  • Enables self service reporting capabilities to end-users


Learn more at www.integra4notes.com.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login