Setting a field with partial array elements

I have an array that has 10 elements

(ie. 1.25, 1.35, 2.36, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00)

I want to set a field in a form with only array the element that have a value greater than zero.

(ie. 1.25, 1.35, 2.36,)

What is the easiest way to do this??

---------------------------- Sample code ---------------------------------

Dim amt(10) As double

For i = 1 To DocCollection.Count

Set workupDoc = DocCollection.GetNthDocument(i)

amt(i)=workupDoc.Price(0)

count = count + 1

Next

Set item= New NotesItem(newDoc,“PQPrice”, amt)

Subject: Setting a field with partial array elements

Dim amt() As double 'note changeDim j as Integer

j = -1

For i = 1 To DocCollection.Count

Set workupDoc = DocCollection.GetNthDocument(i)

If workupDoc.Price(0) <> 0.00 then

j = j + 1

Redim Preserve amt(j)

amt(j)=workupDoc.Price(0)

End If

count = count + 1 'I don’t know what this is for.

Next

If j > -1 Then

Set item= New NotesItem(newDoc,"PQPrice", amt) 

Else

newDoc.PQPrice = ""

End If

Subject: Setting a field with partial array elements

I’d use a dynamically-allocated array:

Dim amt() as Double

Dim count as Integer

count=0

For i=1 To DocCollection.Count

Set workupDoc = DocCollection.GetNthDocument(i)

If workupDoc.Price(0)=0 Then

ReDim Preserve amt(count)

amt(count)=workupDoc.Price(0)

count=count+1

End If

Next

Set item=New NotesItem(newDoc,“PQPrice”,amt)

Subject: RE: Setting a field with partial array elements

Glenn and James,Either way will work for me, Thanks for your help and time.

Bob