Counting Elements in a Computed Field?

Hi All,

I have a computed Text Type Multivalue field(T1) on a Form, which gives text values when someone saves a document.

e.g. “2”;“5”;“6”

I just want to count elements in above T1 field and store in a separate field on the same form.

I’ve added a Number type computed field (T2) with following formular:

@Elements(T1)

Since T1 is initally empty and gets values only when document is saved, I cannot see elements are calculated correctly for this…

All helps are highly appreciated…

Mira

Subject: RE: Counting Elements in a Computed Field??

Perhaps you should use a field Onblur event and refresh the form at that time.

If you need the update to occur before the user exits the field, you could use a NotesTimer to check for changes and post an update. This does, however, seem a bit extreme.

I also wanted to mention that I dislike storing information in documents that can be easily calculated. Why do you need this value stored?

Subject: Counting elements in aDyanamic array? Lotus Script

Well, appreciate your comments.

Can someone tell, how do I count number of elements in a multivalue field in a Document?? ( Using Lotus Script)

e.g.

I have a Text Type multi value field in a document, where number of elements in this field may vary.

When I navigate along the documents ( one by one) , how can calculate number of elements this multivalue field??

Thanks

Mira

Subject: RE: Counting elements in aDyanamic array? Lotus Script

dim somevalue as variantsomevalue = doc.getitemvalue(“fieldname”)

dim elems%

elems = ubound(somevalue) + 1

if elems = 1 then

if somevalue(0) = “” then elems = 0

end if

Subject: Counting Elements in a Computed Field??

I cannot see elements are calculated correctly for this…

Why would @Elements compute the wrong number? If it’s a multivalue field, @Elements returns the right number…