This may be a dumb question, sorry :)
Is there a Lotusscript version of @Elements? I know I can loop through or even use UBound however curious if there is a better way now that we are on V12.
Thanks in advance
This may be a dumb question, sorry :)
Is there a Lotusscript version of @Elements? I know I can loop through or even use UBound however curious if there is a better way now that we are on V12.
Thanks in advance
Hello
If you want to find the number of elements in an array, you can use the UBound function as you said.
Is there anything that Ubound cannot achieve for you?
Regards,
Shigemitsu Tanaka
With V12 also found the same UBound function for deciding the upper bound of an array.
Believe no new function in V12. Refer below doc
Hi there,
what are you lokking for ? What do you expect to find in V12?
If you use a non standard array that, for what ever reason, starts not with 0
i.e. DIM MyTestArray(-10 to 123)
you could define
Function Elements(TheArray)
Elements=ubound(TheArray)-lbound(TheArray)
End function
Or even write a version for more that one dimension.
Sincerly
Jocehn "Joe" Herrmann
You're right Jochen from fast to slow:
1/ lbound/ubound
2/ evaluate("@element) => not sure it is fast but well....
3/ array loop
The only advantage in the not so faster loop (step 3/) is that I've changed the function call to pass a filter (to count number of elts starting with or containing a specific value)
Function Elements(anArray as Variant) as Integer
Dim i as Integer
i = 0
if isarray(anArray) then
Forall values in anArray
i = i + 1
End Forall
end if
Elements = i
End Function
You can use such a code in LS:
http://dominonotes.blogspot.com/2008/11/lotusscript-equivalents-for-elements.html
Jerome,
that could become quiet an expensive operation for big arrays.
Ubound and Lbound are much faster.
Kind Regards
Joe
I guess evaluate in lotus script should do the job
Dim answer as variant
Expression$="@Elements(yourfieldname)"
Dim doc as notes document
*Set the document doc
Answer=Evaluate(Expression$,doc)
Thank you for all the responses. I was hoping they had an @Elements version via Lotusscript in V12.
Ubound can show 1 if the array is (0) and (1). The array should be 2.
Anyway, thank you for all the responses.