Is there a @name equivalent in LS?
I would like to read the value of a name field (which by default is canonical) and convert it to common name.
equivalent of @name([CN]; name1) in LS
– edit
Just to clarify I understand you can do:
dim sName as NotesName
dim MyStr as String
Set sName = s.CreateName(doc.name1(0))
Mystr = name1.Common
but just wondering if there is a LS function to perform the deed in 1 line (instead of 4 lines)
–
thanks
JJ
Subject: @Name for LS
There’s no built-in one-line equivalent to @Name that I know of, but here are a couple of alternatives…
One is to create a function that uses a NotesName internally. If it takes the canonical name as input and returns the common name as output, then you only have to write the function (multiple lines) once and can then convert multiple names with only a one-line call for each name.
The function:
Function CommonName(inputName$)
Dim nameObj As New NotesName(inputName)
CommonName=nameObj.Common
End Function
The “main” code that calls it:
Dim MyStr As String
Mystr=CommonName(doc.name1(0))
Another solution is to use the Evaluate function to call @Name, but note that function returns an array which you need to then convert to a string. E.g.:
Dim MyStr As String, tmpVar As Variant
tmpVar=Evaluate(“@Name([CN]; name1)”, doc)
Mystr=tmpVar(0)
Subject: RE: @Name for LS
thanks for the response. that was a great tip