• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3535
  • Last Modified:

LotusScript Array used to capture entire contents of multivalue field - only getting first entry of multiple values

Trying to get the entire contents of the shortname field in the address book - only getting first entry in list.
Please assist.

Function FEmail (docx As NotesDocument) As String
With docx
Dim itemArray As Variant
Dim itemList List
Dim m As Integer

Dim NumFAlias As String 'Declare NumFAlias as type string

itemArray = docx.shortname


For m = 0 To Ubound (itemArray) ' Ubound is a function that returns a number of the highest index in the array itemArray - remember array start with a zero (0) index (if Ubound returns 7 there ' are 8 members in the array)

NumFAlias = itemArray(m) ' Use the value of shortname field
FEmail = Lcase$(NumFAlias & IDOMINIO)
Next m
End With
End Function

0
KTTKTT
Asked:
KTTKTT
4 Solutions
 
cezarFCommented:
Your program seem to be getting just the last entry.

try...
NumFAlias = itemArray(m) ' Use the value of shortname field
FEmail = FEmail & ", " & Lcase$(NumFAlias & IDOMINIO)

0
 
Sjef BosmanGroupware ConsultantCommented:
Hello KTTKTT,

If you want the entire contents concatenated, try this:

Function FEmail (docx As NotesDocument) As String
      FEmail= Join(docx.shortname)
End Function

Regards,
   Sjef
0
 
Bill-HansonCommented:
There is nothing syntactically wrong with your code.  Each time the loop executes, a value from the "shortname" field is stored in the "FEmail" variable.  The next time the loop executes, the "FEmail" variable is overwritten with the next value in the field.  At the end of the loop, the "FEmail" variable will hold the last value in the field.

So, I have to ask:  What are you trying to accomplish with this script?  If we know your intentions, we will be better able to help.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
KTTKTTAuthor Commented:
cezarF:  used your solution - it worked but now i have to get rid of the commas. How do I do a trim with this solution to remove commas?

sjef_bosman: thanks for this example as well.

Bill-Hanson: I appreciate the thorough explanation on how the code was looping - that explained the problem.   Just simply grabbing the shortnames to export to .xls.
0
 
Bill-HansonCommented:
Sjef had the easiest solution:

FEmail= Join(docx.shortname)

The Join function does all the looping for you and can delimit the text using any character that you wish.  The default is a space.
0
 
cezarFCommented:
@Kitkit: I Agree sjef and Bill-Hanson. It would have been easier if you used Join.  To answer your question, just change the ", " with " " or any delimiter you want.  

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now