?
Solved

how do I return an array from classic asp vbscript function

Posted on 2010-09-05
6
Medium Priority
?
1,135 Views
Last Modified: 2012-05-10
hello EE warriors...

quick question.
How do I return an array from a VBScript function?

See code below:
Function todayslist

    Dim list(3)

    list(0) = "NBC Last Comic Standing"
    list(1) = "ABC Late Night with David Letterman"
    list(2) = "CBS Presidental Speech" 

    dim event1
    dim event2
    dim event3

    event1 = "NBC Last Comic Standing"
    event2 = "ABC Late Night with David Letterman"
    event3 = "CBS Presidental Speech"


    return list


End Function


    Dim todaysevents
    todaysevents = todayslist()
    if todaysevents.count > 0 Then
        Response.write("<ul>")
        For each Item in todaysevents
            Response.write("<li>" + Item)
        Next
        Response.write("/<ul>")
    end if

Open in new window

Function todayslist

    Dim list(3)

    list(0) = "NBC Last Comic Standing"
    list(1) = "ABC Late Night with David Letterman"
    list(2) = "CBS Presidental Speech" 

    dim event1
    dim event2
    dim event3

    event1 = "NBC Last Comic Standing"
    event2 = "ABC Late Night with David Letterman"
    event3 = "CBS Presidental Speech"


    return list


End Function


    Dim todaysevents
    todaysevents = todayslist()
    if todaysevents.count > 0 Then
        Response.write("<ul>")
        For each Item in todaysevents
            Response.write("<li>" + Item)
        Next
        Response.write("/<ul>")
    end if

Open in new window

0
Comment
Question by:Evan Cutler
  • 4
  • 2
6 Comments
 
LVL 59

Expert Comment

by:Bill Prew
ID: 33608548
Try changing

return list

to

todayslist = list

~bp
0
 
LVL 59

Expert Comment

by:Bill Prew
ID: 33608570
Try this.

~bp
Function todayslist
 
    Dim list(3)
 
    list(0) = "NBC Last Comic Standing"
    list(1) = "ABC Late Night with David Letterman"
    list(2) = "CBS Presidental Speech" 
 
    dim event1
    dim event2
    dim event3
 
    event1 = "NBC Last Comic Standing"
    event2 = "ABC Late Night with David Letterman"
    event3 = "CBS Presidental Speech"
 
    todayslist = list
 
End Function
 
    Dim todaysevents
    todaysevents = todayslist()
    if ubound(todaysevents) > 0 Then
        Response.write("<ul>")
        For each Item in todaysevents
            Response.write("<li>" + Item)
        Next
        Response.write("/<ul>")
    end if

Open in new window

0
 
LVL 9

Author Comment

by:Evan Cutler
ID: 33608589
nope.
says object required.

any other ideas?  :)


Thanks
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 59

Accepted Solution

by:
Bill Prew earned 2000 total points
ID: 33608600
In my second post, with the ubound() changes, you still got "object required"?

~bp
0
 
LVL 9

Author Closing Comment

by:Evan Cutler
ID: 33608607
YOUR AWESOME

Thanks
Evan
0
 
LVL 59

Expert Comment

by:Bill Prew
ID: 33608619
Welcome.  Glad that helped, thanks.

~bp
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses
Course of the Month16 days, 1 hour left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question