Authors/Readers field - Not able to sort

I am developing a form with Authors and Readers field. On the Control-tab for the Field Properties I have selected “Use Access Control List for choices”.

The user experience works ok, the user can select which person is able to edit the document, but the “Select Keyword”-dialog is a real mess, because it is not sorted.

I have found no way to sort this list. Does anyone know how to do this?

Regards

Henry

Subject: RE: Authors/Readers field - Not able to sort

You would have to do some extra work. Specifically, you would need LotusScript code to read the ACL, sort the choices, and then use Prompt to present them to the user.

Subject: RE: Authors/Readers field - Not able to sort

Andre, thanks for your tip!!

This is the code I ended up with:

Sub Click(Source As Button)

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim session As New NotesSession

Dim db As NotesDatabase

Dim acl As NotesACL

Dim entry As NotesACLEntry

Set uidoc = workspace.CurrentDocument

Set db = session.CurrentDatabase

Set acl = db.ACL



'Counts numbers of entries in  ACL

NumOfChoices = 0

Set entry = acl.GetFirstEntry

While Not ( entry Is Nothing )

	NumOfChoices = NumOfChoices + 1

	Print entry.Name 

	

	Set entry = acl.GetNextEntry( entry )

Wend



'and saves this in an array

i = 0

Dim choices() As Variant

Redim choices(NumOfChoices - 1)

Set entry = acl.GetFirstEntry

While Not ( entry Is Nothing )

	

	choices(i) = entry.Name

	i=i+1

	Set entry = acl.GetNextEntry( entry )

Wend



'Sorts choicesin Prompt box

For intX=0 To Ubound(choices)        

	For intY=0 To Ubound(choices)			            

		If choices(intX) < choices(intY) Then                 

	'Swap values                

			strTemp=choices(intX)                

			choices(intX)=choices(intY)                

			choices(intY)=strTemp						            

		End If        

	Next              

Next



'Shows all choices in  @Prompt box

chosen = workspace.prompt (PROMPT_OKCANCELLISTMULT, "Choose users...", "Who will be able to edit this document?", "", choices)	

	

'Converts the arrayet til comma-separated text, because of FieldSetText

NumInChosen = Ubound (chosen)

Forall x In chosen

	chosenTxt = chosenTxt + x + ", "

End Forall

LengthOfChosenTxt = Len (chosenTxt)

chosenTxt = Left (chosenTxt, LengthOfChosenTxt - 2)



'Write back to field in document, doing this in front-end

Call uidoc.FieldSettext ("Editors", chosenTxt)

End Sub