Manage Learn to apply best practices and optimize your operations.

Overcome unsorted document collections using Picklist and a categorized view

This tip describes how to overcome unsorted document collections using Picklist and a categorized view.

I have come across what seems to be an undocumented feature of the PickList Modal Window. Whether you use Script or Formula, the return value seems to be sorted by the CLICK ORDER, as determined by the End User.

As part of an Application I was required to provide the end User with a predefined collection of documents. The End User should be able to transfer values from each document in this collection to a summary field within the uidoc, the Criteria being that the summary data had to be listed in the order defined by the EndUser. In other words, the solution was to enable data sorting on the fly.

The feature of the PickList modal window solved all my problems in a flash. The EndUser checks documents within this window, and values are returned sorted by THE CLICK ORDER.

Now I ran tests with both Script and Formula, and use both under different circumstances:

1. When Column Value is sufficient, use Formula. It is swift and precise. I have tested with script and it is much slower.

Code for button: (where values is a field in uidoc which reflects a Category in Main View, and Results is a MultiValue Computed Text Field)

var:=@PickList( [Custom] ; "server" : "path; "Main View" ; "Documents" ;"Select Docs in Click Order Sequence"; 2; values); FIELD Results:=var; @True

2. When other data is required based on conditions, i use script, and pull a value from column which stores the Unique id of the document. Then use the db.GetDocumentByUnid method to access each document, and pull values from it. The beauty is that the collection does not need sorting. It will loop through each unid obtained by the CLICK ORDER.

Dim ws As New notesUiworkspace
Dim unidList As Variant
Dim db As notesdatabase
Dim results As notesitem
Dim uidoc As notesuidocument
Dim doc As notesdocument
Dim note As notesdocument
Dim session As New notessession

Set db = session.currentdatabase
Set uidoc=ws.currentdocument
Set doc = uidoc.document
Call uidoc.refresh()
'cat$ refers to the View Category...
this value may be precomputed, or 
selected from list
path$="D:ToolsFrom DiscCode.nsf"
'get a handle on the Field which will 
store the return values in the order 
determined by end user
Set results = doc.GetFirstItem("Results")
unidList = ws.PickListStrings
( PICKLIST_CUSTOM, True,server$,
path$,"Main View", _ 
"Append Documents: " & cat$,"Select 
Forall v In unidList
unid = v
Set note = db.GetDocumentByUnid(v)
Call results.AppendToTextList(note.
Topic(0) & " created by " & note.Author(0) 
& " on " & note.Creation(0))
End Forall 

Dig Deeper on LotusScript



  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...