In this (old) redbook, in Appendix B-4, you will find Lotus Script code for all the algorithms shown in the graph. I allwas use the QuickSort – think this works best in most situations.
Also check this Animated Sorting Algorithms site
Conclusion from the redbook:
Sorting can be a complex issue to decide. The amount of time taken to get
your data into arrays to allow you to use a sort routine may be longer than
the actual sorting. You then will need to get the sorted data out of those
arrays. You may be able to sort the data as you are preparing it or use the
resulting array as is.
There are many factors that influence the type of sort to use. Maybe creating
an extra view will solve all your problems.
In any case, you’ll need to think about your sorting needs. The examples
here use internal arrays of strings, so the problem is nicely encapsulated. For
these examples, the shell sort routine seems to be the easiest to code and
provides excellent performance.
If you are in a position to require a sophisticated sorting routine, spend some
time understanding these routines, and do some reading. The differences in
performance can be amazing!
I have used three methods (at different customers):
- Setting the StartupDb parameter in notes.ini
- Creating a new frameset in bookmark.nsf – and launch this (from database launch properties on the bookmark.nsf)
- Creating a script that adds the database to the ‘Startup’ bookmark group (found in your bookmark bar, under ‘More Bookmarks’ )
1. Set a startup database in notes.ini
replicaId = Left( db.ReplicaID, 8 ) & “:” & Right( db.ReplicaID, 8 )
Call session.SetEnvironmentVar( “StartupDb”, replicaId, True )
Comments: will open the database in a secondary tab. Will have focus when launched
2. Create a new frameset in bookmark.ntf (note – make the changes in the template file)
- Create a new frameset with one frame. Let the frame show a link – and include a notes url to the database/frameset you will open
- Set the launch settings to open the new frameset (in the database properties box)
- Copy the new bookmark.ntf to all clients
Comments: will be the first tab (instead of the workspace) and can’t be closed by the user
3. Place the bookmark in the Startup folder (under ‘more bookmarks’) using Lotus Script:
Comments: Opens a secondary tab, but will not have focus and will not load before user activates. You can launch several databases in this way. My personal favorite.
Function setStartup( intranetdb As NotesDatabase )
Dim session As New NotesSession
Dim bookmarkDb As NotesDatabase
Set bookmarkDb = session.GetDatabase( “”, “bookmark.nsf” )
Dim outline As NotesOutline
Dim entry As NotesOutlineEntry
Set outline = bookmarkDb.GetOutline( “UserBookmarkOrder” )
‘find the “Startup” folder
Set entry = outline.GetFirst
Do Until entry.Label = “Startup”
Set entry = outline.GetNext( entry )
If entry Is Nothing Then Print “Can’t find the entry – operation stopped” : Exit Function
‘Startup folder found. First, delete all bookmarks in thhis folder
Dim nextentry As NotesOutlineEntry
Set nextentry = outline.GetNext( entry )
Call outline.RemoveEntry( nextentry )
‘Next, create a new bookmark in the folder
Dim bookmark As NotesOutlineEntry
Set bookmark = outline.CreateEntry( intranetDb.Title, entry, True, True )
Call bookmark.SetNoteLink( intranetdb )
bookmark.ImagesText = “$Icon”
Print intranetdb.Title & ” added to the startup folder”
Well, this can be done in several ways:
1. Printing to a ‘barcode’ printer (with a builtin barcode font).
Have been using a Citizen CLP-621 printer. The print job is just a text file, created with Lotus Script. Text file contains all the control codes for the printer, e.g. page width, borders, font size etc. The manual were quite good – with lots of details and examples.
Only one problem – how to copy/spool the print file to the printer? Found a small freeware spooler program -> http://www.lerup.com/printfile/ When started and configured, it can copy all files from a folder to any printer
It works perfectly 🙂
2. Install your own barcode font and print using word or Lotus Notes
Found the fonts on http://www.idautomation.com. They have all fonts, with documentation and Lotus Script code to generate the barcode string (convert a number to a barcode string with checksums). Just make sure to select the right font. Some fonts doesn’t support charecters and some doesn’t support special charecters – and do check that your scanners support the selected font.
When you have the font, it is simple to create a print form in Notes. Did try to use Microsoft word – but some barcodes had special chars that was destoyed by Word, and didn’t work…
This is easy – the barcode scanner handles everything for you.
If you use a USB scanner, the scanned barcode will be typed at the cursor – from here it is easy to process with LotusScript if needed.
With this option you will not loose the $ref field – even if the form is a ‘Document’ type (and not a ‘Response’ type). In this way you can use the same form as both reponse and main document (just have to create the responses with LotusScript, doc.MakeResponse…)
>> Found this tip on http://dpastov.blogspot.com
Nice (but undocumented) function to expand a group:
@ExpandNameList( server:file; groupname )
Has been there since release 5, but it still works.
Notice: @ExpandNameList will only work on Mail groups – ‘Access Control List only’ groups are not included (will return an empty array).
Sample script to resolve a list with mixed groups and functions:
Find all members in a group or list of groups and persons
Will also work when running on a local replica (but requires server access)
Function getMembers( GroupOrNameList As Variant ) As Variant
Dim members As Variant
'find a server (use the homeserver if script is running on a local database)
Dim server As Variant
server = Evaluate(|@if( @subset( @dbname;1 ) = ""; @LocationGetInfo([HomeServer]); @subset( @dbname;1 ))|)
If Isarray( GroupOrNameList ) Then
Forall member In GroupOrNameList
If Isempty( members ) Then
members = getMembers( member )
members = Arrayappend( members, getMembers( member ))
members = Evaluate(|@ExpandNameList( "| & server( 0 ) & |":"names.nsf"; "| & GroupOrNameList & |" )|)
'fix problem with persons with an forward address on the person document
Dim i As Integer
Dim v As Variant
For i=0 To Ubound(members)
If lcase( Left(members(i), 3))<>"cn=" Then
v = Evaluate(|@NameLookup( [NoUpdate] ; "|+members(i)+|"; "fullname")|)
if v( 0 ) = "" then
v = Evaluate(|@NameLookup( [NoUpdate] ; "|+strleftback( members(i), "@" )+|"; "fullname")|)
If Not Isempty(v) Then
members = Arrayunique( members,5 )
getMembers = members
Found these hidden features in Lotus Notes:
1: Set coll = db.CreateDocumentCollection
//no more set coll = db.GetProfileDocCollection( don’t find me rubbish )
2: NotesView.GetColumnValues (@DbColumn in LS)
//no more evaluate( @dbcolumn( …. ) )
Just a shame they didn’t find there way into the help file……
More info here -> http://www.lotus911.com/nathan/escape.nsf/D6Plinks/NTFN-7GTSH4