Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Standard CASE function? 1

Status
Not open for further replies.

WhiteTiger

Programmer
Jun 26, 2001
605
US
Ok, how could I do a case function in javascript or vbscript?...I have a Map.asp of the office, and were setting it up so you can click our little cages...oops, I mean, cubicals, and get information on who's there etc...(Yes, kind of like a jail system!)...but I was wondering, I was thinking of doing a CASE system then throwing some text in each one...just for quick coding so the boss could see...how would this be accomplished in VBscript (preferably)?...

Also, if anyone knows databases...how could I grab a database entry and write it down according to cubicle number (it's already in the database)...

I want to be able to grab that number passed through Map.asp and retreve it and display the rest of the information... Regards,
Anth:cool:ny
----------------------------------------
"You say [red]insanity[/red] like it's a BAD THING!"
 
Here is the case statement for VBscript

sub whatever()
SELECT case var

case "cube1"
Stuff about this person
case "cube2"
Stuff about this person
case else
what to put if no case statement matches
end select
end sub
 
Hmmm...crud, I'm passing the extention number via ASP...how could I get it to write it...I keep getting end of statement expected when using that...

Code:
<%@ language=&quot;vbscript&quot; %>
<%
Response.Expires=0 
ext=request(&quot;ext&quot;)
%>
<html>

<head>
<!-- #include virtual=&quot;/common/scripts/db.vbs&quot; -->
<link href=&quot;/common/style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;>
</head>

<body>

<p>Map.asp, need database code...but the extention is <%whosthere(ext)%> </p>
<script language='VBScript'>
sub whosthere(numba)
SELECT case numba
  case &quot;3044&quot;
      document.write(&quot;Uhmmm...yea&quot;)
  case &quot;3045&quot;
      document.write(&quot;HI!&quot;)
  case else
      document.write(&quot;HI!11&quot;)
end select
end sub

</script>

</body>

</html>

How would I get that...I'm not awake again today and I dont use scripting that often, but I come in here, and ask so I can learn. Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
OK let me get this straight. You have a visual map of your cube layout. And you want a person to be able to click on a cube and then have it tell them the extention number for that cube
 
No, I want it to open information VIA cube number...

we have an Office Map...Officemap.asp

which passes the links via an image map...like so
Map.asp?ext=3044
Map.asp?ext=3048

And I want to take that extention #, and pull information via a case...

I keep getting expected end of statement errors and can't figure out the syntax that I'm messing up or anything... Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
OK I get it..

So the person has selected the cube on another page and you are going to show them the info.

<%@language = vbscript %>
dim ext
set ext = Request.Querstring
sub whatever()

Select Case ext
case &quot;3044&quot;
response.write(&quot;bla,bla,bla&quot;)
case &quot;###&quot;
response.write(&quot;more stuff&quot;)
case else
response.write(&quot;ooppps&quot;)
end select
end sub %>
<html>
<body>
Here is where your stuff would write out <% call whatever() %>


I believe that will give you what you need to get a start on it.
 
ok, I guess this is for the ASP forums then...(I didn't even know there was one until now...oops)

Ummmm...that's the problem I'm having, is...oh, wait...will the VBScript pick up the ext just by the case if I pass it like that?...Hmmm...hold on, I'll be right back...;) Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
Now I get a type mismatch...is there a way to pass the information to the variable?...or whats causing that?

I get a type mismatch when trying to do
Code:
<p>Testing...Result: <%whosthere()%> </p>

and the whosthere code has the case function you gave me, except I call for the stuff afterwards in a script tag...think I could mail someone the 2 things then perhaps have you try it?...think it would be lots less confusing. Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
OK when you call the stuff. Are you doing it server side or client side. in order for this to work it has to be done server side. <% call whatever()%> then you also have to assign the variable server side as well so that would mean <% dim ext
set ext = request.form(&quot;ext&quot;) or
set ext = request.Querystring (if the data is in your url) If those changes don't work for you can send me what you have and I will take a look at it.
 
Hey I have an even better idea. I have mocked up a very crude but workable version of what you are trying to do. If you want to send me your email address I can send them to you so you can see how they work.

Roj
 
amorris@forumarchitecture.com

Thanks...I appreciate it very much. Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
tell me if/when you send it!...;-) Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
YAY! FOUND IT ALL OUT...stupid me...I didn't have
Code:
<% and %> tags around my sub! Regards,
Anth:cool:ny
----------------------------------------
&quot;You say [red]insanity[/red] like it's a BAD THING!&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top