Picklist & Canonical

Hi,

I am trying to set field “InitiatedBy” to the full name of the person selected. “Demo User/ABC/DEF”, etc.

But it only displays “Demo User” when the following script is run. I am 100% sure that the first value in the lookup column, containts the FULL name of the person (Demo User/ABC/DEF). There are no translation formulas on the form to display only the common name, however, it only seems to extract the comman name. The value in the view is the Full Name with the Organizational Unit, etc. etc. What am I doing wrong?


Sub selectName

Dim ws As New NotesUIWorkspace

Dim s As New NotesSession

Dim db As NotesDatabase

Dim uidoc As NotesUIDocument

Dim enqName As Variant

Dim enqNameNotes As NotesName

Dim enqDetails As Variant

Set db = s.CurrentDatabase

prompt$=“Please select the name of the Enquirer”

enqName = ws.PickListStrings(3, False, db.server, db, “LU View”, “Select Enquirer”, prompt$, 9, “”)

If Not Isempty(enqName) Then

If enqName(0) <> “” Then

Set uidoc = ws.ComposeDocument( “”, “”, “ViewName” )

'----- RETURN STRING WITH VALUES SEPERATED BY *. EXPLODE TO ARRAY, ACCESS INDIVIDUALLY

enqDetails = Explode(enqName(0),“*”)

Set enqNameNotes = New NotesName(enqDetails(0))

Call uidoc.FieldSetText(“InitiatedBy”, enqNameNotes.Canonical)

Call uidoc.FieldSetText(“Office”, enqDetails(4))

Call uidoc.FieldSetText(“Phone”, enqDetails(2))

Call uidoc.FieldSetText(“Fax”, enqDetails(3))

Call uidoc.FieldSetText(“Level”, enqDetails(1))

End If

uidoc.Refresh *** I have even tried taking this out, just in case.

End If

End Sub

Subject: Picklist & Canonical

Lexi,

In addition to what Andre said, look at the following line:

Call uidoc.FieldSetText(“InitiatedBy”, enqNameNotes.Canonical)

It is putting the CANONICAL form of the name into the field named InitiatedBy. If you replace “Canonical” with “Common” you will get the common name you are looking for:

Call uidoc.FieldSetText(“InitiatedBy”, enqNameNotes.Common)

Gary

Subject: RE: Picklist & Canonical

Hi Gary,

Thank you for the response, but I’m trying to get the Full Name, not the Common Name.

Subject: RE: Picklist & Canonical

Sorry Lexi I read part of your post wrong – okay – just change the line I gave you to this:

Call uidoc.FieldSetText(“InitiatedBy”, enqNameNotes.Abbreviated)

The Abbreviated form of the name gives you the Organizational Units and Organization without the “OU=” etc. so it will return something like:

Joseph Bloe/ABC/YourCompany

Gary

Subject: RE: Picklist & Canonical

What you are doing wrong, is failing to debug the application to see at what point you’re getting an incorrect value.

Also note that picklist has an option that lets you grab the selected document(s) instead of a string. That means you can read the original field values directly from the original document and eliminate an expensive-to-calculate view column.

Subject: RE: Picklist & Canonical

Thanks Andre, I’ll give PicklistCollection a go.