About Duffbert...

Duffbert's Random Musings is a blog where I talk about whatever happens to be running through my head at any given moment... I'm Thomas Duff, and you can find out more about me here...

Email Me!

Search This Site!

Custom Search

I'm published!

Co-author of the book IBM Lotus Sametime 8 Essentials: A User's Guide
SametimeBookCoverImage.jpg

Purchase on Amazon

Co-author of the book IBM Sametime 8.5.2 Administration Guide
SametimeAdminBookCoverImage.jpg

Purchase on Amazon

MiscLinks

Visitor Count...



View My Stats

« What Are Directory and Database Links? How Are They Used? | Main| Is There a Notes.ini Parameter To Set a Specific Database To Open on Launch of Notes? »

Can a LotusScript Function be Designed to Return an Array?

Category Software Development


I don't know if I really wanted to post this due to content, or I just loved the fact that a KnowledgeBase item actually used the word "funky"...


Can a LotusScript Function be Designed to Return an Array?

Document Number:  1090574

Problem

Can a LotusScript Function be Designed to Return an Array?


Content

LotusScript functions are designed to return a scalar value, a Variant or an object reference.  An array can be returned using a Variant.   This can be done by either indicating "As Variant" or leaving it blank as variant is the default return type.


For example, either of the below will cause the function to return a Variant value:


Function Funky(a As String, b As String) As Variant

Function Funky(a As String, b As String)


Code example:


Given the function supplied below, the value of the result variable will be an array: result(0)="parta", result(1)="partb".


Sub Initialize

       result=Funky("parta", "partb")

End Sub


Function Funky(a As String, b As String) As Variant

       Dim cc(0 To 1) As String

       cc(0)=a

       cc(1)=b

       funky=cc

End Function

Comments

Gravatar Image1 - I use this frequently in methods of classes. Returning an array can be very helpfull for looping, e.g. forall v in getTable.getrows.

Using this I encountered one problem: returning an "empty" array, an array that is accepted by the forall loop and skips it .

I already posted it here: http://www.looseleaf.net/Looseleaf/Forum.nsf/8178b1c14b1e9b6b8525624f0062fe9f/80f66b0fada62ca585256e310048e05c?OpenDocument

Do you have any suggestions?

Gravatar Image2 - Hi, Jasper... It looks like Bob had a pretty good suggestion, and your workaround didn't sound too bad either. I don't have much more to add off the top of my head.

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)

Want to support this blog or just say thanks?

When you shop Amazon, start your shopping experience here.

When you do that, all your purchases during that session earn me an affiliate commission via the Amazon Affiliate program. You don't have to buy the book I linked you to (although I wouldn't complain!). Simply use that as your starting point.

Thanks!

Thomas "Duffbert" Duff

Ads of Relevance...