Manage Learn to apply best practices and optimize your operations.

Sort NotesOutline

This tip shows you how to sort a NotesOutline object at either the root or first child level.

This tip shows you how to sort a NotesOutline object at either the root or first child level. Pass in "" as strParent to sort the root level otherwise pass in the element name to sort under.

It's not very efficient, but since outlines aren't too, too big, it works fine.

Sub OutlineSort ( outline  As NotesOutline, strParent As String) 
     'This routine sorts the outline in alphabetical order 
	Dim swap As Integer
	Dim found As Integer
	Dim bFound As Integer
	Dim currententry As NotesOutlineEntry
	Dim nextentry As NotesOutlineEntry
	Dim rootentry As NotesOutlineEntry
	bFound = False	
	Set rootentry  = outline.GetFirst()
	While Not rootentry Is Nothing And Not bFound
		If rootentry.Label = strParent Then
			bFound = True
		End If
		If Not bFound Then
			Set rootentry = outline.GetNextSibling(rootentry)	
		End If		
	If strParent <> "" And Not bFound Then
		Exit Sub 'Parent entry not found
	End If
	swap = False
	If strParent <> "" Then
		Set currententry  = outline.GetChild(rootentry)
		Set nextentry = outline.GetNextSibling(currententry)
		Set currententry  = outline.GetFirst()
		Set nextentry = outline.GetNextSibling(currententry)
	End If
	While Not (currententry  Is Nothing)  And Not (nextentry  Is Nothing) And  swap <> True 
		If currententry.Label > nextentry.Label Then
			Call outline.Moveentry(currententry , nextentry, True, False)
			swap = True
		End If
		Set currententry = outline.GetnextSibling(currententry )
		Set nextentry = outline.GetnextSibling(nextentry )		
	If swap Then
		Goto top
	End If
End Sub

Dig Deeper on Domino Resources - Part 6

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • 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 ...