Sub Click(Source As Button)
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim uidoc As notesuidocument
Dim flag As String
Dim w As New NotesUIWorkspace
Dim s As New NotesSession
Set db = s.CurrentDatabase
Set uidoc=w.currentdocument
Set doc = uidoc.document
On Error Resume Next
'Because canonical names are used in combination with flat names
'we need to abbreviate the list coming in to do the sort correctly.
'otherwise, the sort would be off because canonical names internally all start with CN=
'which causes a flat name to sort before a canonical one even if the first letter of the common name
'comes before the first letter of the flat name. To insure correct return values, we canonicalize before
'we save the note. We use Evaluate because it is faster to run the @Name on the list then looping
'through all possible members and abbreviating them in script.
FieldList=Evaluate(|@Name([Abbreviate];P1Liste)|,doc)
Call QuickSort(FieldList)
Call doc.ReplaceItemValue("P1Liste",SortedArray)
Call doc.ReplaceItemValue("P1Liste", Evaluate(|@Name([Canonicalize];P1Liste)|,doc))
Call uidoc.refresh
End Sub
Gruss
Andy