[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Anyway to get a count of items in a list

Posted on 2006-04-27
8
Medium Priority
?
251 Views
Last Modified: 2013-12-18
Greetings most learned experts,

Tis I again (of course!). R5.0.12. Anyway my question is can I get a count of the number of items in a list other than just buidling one up as I make the list. For example,

Dim myList List As String

myList("addr") = "123 Main Street"
myList("city") = "Anytown"
myList("telephone") = "1234-5678"

I know that there are 3 items but do I need to build up a count by putting in a counter. The reason I ask is because this information gets passed from a function and the list tag names are the same as the field names they are supposed to populate. That is,

doc.addr = myList("addr")
etc.

It's a bit tedious for typing, I've done it but was wondering if there was a better way to do this?

My heartfelt thanks - Notes Rookie
0
Comment
Question by:notesrookie
8 Comments
 
LVL 14

Expert Comment

by:p_partha
ID: 16556996
forall x in myList

end forall
0
 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 200 total points
ID: 16557051
As p_partha says use a forall loop to work through the items in a list.  If you want to get the number in there use ubound(mylist).  You can get the name of each item using ListTag.

i.e. I guess this would work for you?

forall x in myList
  doc.replaceitemvalue(listtag(x),x)
end forall
0
 
LVL 14

Accepted Solution

by:
p_partha earned 800 total points
ID: 16557055
forall x in mylist
itemname = listtag(x)
Set notesItem = doc.AppendItemValue( itemName, x )
endforall

Hope this helps
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 43

Expert Comment

by:Steve Knight
ID: 16557060
:-)
0
 

Author Comment

by:notesrookie
ID: 16557638
Hey p_partha. Thanks for the suggestion. I replaced the AppendItemValue with ReplaceItemValue and it worked great. That is,

forall x in mylist
itemname = listtag(x)
Set notesItem = doc.ReplaceItemValue( itemName, x )
end forall

And it definitely helped.

And dragon-it, thanks for the suggestion on getting the count. That was the way I thought I was going to go but knew that had to be a better way to do it.
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 16557833
Thanks for the points, sorry p_partha was just adding to your original comment but then you did too :-)
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16560924
Ubound(mylist)? AFAIK this doesn't exist. Ubound is defined for Arrays only.

The error you get is obvious: Type mismatch on mylist
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 16561009
Very Good point.  Fairly obvious really I suppose.  I've always used forall and listtag to be honest :-)

Steve
0

Featured Post

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Screencast - Getting to Know the Pipeline
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question