Directly Add Two NotesItem Value(s)

i have to add values from two docs. The fields are called v01, to v15. So i use the getfirstitem to get a pointer to each

item1 = doc1.getfirstitem(v01)

item2 = doc2.getfirstitem(v01)

now, i need to add the values as in item1 = item1 + item2

how can i do that?

Subject: Directly Add Two NotesItem Value(s)

There are several ways to do this. Here are a couple. You just have to remember that all notes fields and object created from fields are inherently arrays. So you need to designate the element of the array you want (0), (1), etc. In your case, it is (0):

Option 1:

sum1 = doc1.v01(0) + doc2.v01(0)

Option 2:

Set item1 = doc1.GetFirstItem("v01")

Set item2 = doc2.GetFirstItem("v01")



sum1 = item1(0) + item2(0)

Just be sure to add data validation for each incoming data element to insure that it is a number before you begin your calculation, or your’re going to have some run-time issues.

Russell

Subject: RE: Directly Add Two NotesItem Value(s)

that is what i do, but i was wondering if there was a better way. thanks. and happy holidays.