I need your help: I don’t know how to get the number of elements of the “progetti” field in the following script:
Sub Click(Source As Button)
Dim db As NotesDatabase
Dim s As New NotesSession
Dim profile As notesdocument
Dim progetti As Variant
Set db = s.GetDatabase ("server","db.nsf")
Set profile = db.GetProfileDocument ("frm008")
Set progetti = profile.GetFirstItem ("prof_projects")
—> what should I do to get now the number of items of the “progetti” field?
As has been already suggested the UBound function will give you the Upper Boundry of the Variable. However the Base by default is Zero so it will return 9 if there are 10 elements because the first element returns 0. You can change the Base to to 1 so that UBound returns 10 for a 10 element array by setting
I agree I always (well almost always) leave the Base at 0, I find it easier to remember to add One than trying to remeber if the Base was changed. I part because I am called on to work with lots of peoples different code.
Returns the upper bound for one dimension of an array.
Syntax
UBound ( arrayName [ , dimension ] )
Elements
arrayName
The name of an array.
dimension
Optional. An integer argument that specifies the array dimension for which you want to retrieve the upper bound.
Return value
UBound returns an Integer.
Usage
The default value for dimension is 1.
LotusScript sets the upper bound for each array dimension when you declare a fixed array, or when you use ReDim to define the array dimensions of a dynamic array.