Solved

How to display VarType 8200 in my ASP classic

Posted on 2004-04-26
17
2,495 Views
Last Modified: 2007-12-19
I have a webpage created using classic ASP that recieves a variable from a web service written in C#. My problem is that I cannot display the contents of this variable if my life depended on it, and to some extent it does. I would call myself close to an expert in ASP but this is just beyond my reach.

I know for sure that it is an array of some sort and the description from the documentation I have says: array of key, value pairs describing applet parameters. Keys are: "code", "archive", "width", "height", "helpfile"

When I try Response.Write(VarType(myMagicVar)) it returns 8200 which I have found to be "an array of Strings" but I could hardly find any documentation about it. Absolutely ALL attemts for the last 3 hours have given me the result "Type mismatch" when trying to write out the content  except for this: Response.Write(Ubound(myMagicVar)) which returns 9 every time.

Please enlighten me...
0
Comment
Question by:HenningF
  • 7
  • 6
  • 3
  • +1
17 Comments
 
LVL 4

Assisted Solution

by:lpzCoville
lpzCoville earned 100 total points
ID: 10924718
So if you try, say;

Response.Write myMagicVar(0)

or

Response.Write myMagicVar("code")

what does it spit out?

things to try:

For Each X in myMagicVar
    Response.Write x
    Response.Write myMagicVar(x)
Next


For i = LBound(myMagicVar) To UBound(myMagicVar)
    Response.Write myMagicVar(i)
Next

Good luck.





0
 
LVL 15

Expert Comment

by:deighc
ID: 10926652
What does the TypeName function return variable??

Response.Write TypeName(myMagicVar)

Just curious..
0
 
LVL 1

Author Comment

by:HenningF
ID: 10927296
The variablename is actually "AppletInfo" so I'll use that instead:[code]Response.Write "<BR>" & VarType(appletInfo)     => 8200
Response.Write "<BR>" & TypeName(appletInfo)  => String()
Response.Write "<BR>" & appletInfo(0)                => Type mismatch: 'AppletInfo'
Response.Write "<BR>" & appletInfo("code")        => Type mismatch: 'AppletInfo'

For Each x in appletInfo                                      => Type mismatch (on this line)
    Response.Write x
    Response.Write appletInfo(x)
Next

For i = LBound(appletInfo) To UBound(appletInfo) => Illegal assignment: 'I' (!!!!!!!!!!!!! wtf??)
    Response.Write appletInfo(i)
Next

For j = LBound(appletInfo) To UBound(appletInfo)
    Response.Write appletInfo(j)                           => Type mismatch: 'AppletInfo'  (in this line)
Next[/code] Thanks for any insight guys, got any more tricks up your sleeves...?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:HenningF
ID: 10927333
isn't it possible to edit your posts here?? been a while since I used it and I can't seem to find how o edit my last post...
0
 
LVL 15

Assisted Solution

by:deighc
deighc earned 200 total points
ID: 10927340
My guess is that web service is returning a .NET type that isn't supported outside of the .NET framework.

Check out these pages from the VBScript documentation:
VarType
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsfctVarType.asp?frame=true
TypeName
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsfctTypeName.asp?frame=true

I don't see any mention of a VarType 8192 or a TypeName "String()".

In .NET a string is an array of characters. Maybe that's what you're web service is returning and maybe this type simply isn't backwards compatible??
0
 
LVL 28

Expert Comment

by:sybe
ID: 10927405
Apparently it is a datatype that VBScript can not handle.
I am afraid you have to write a component to handle the datatype (for example rewrite it into a normal array)
0
 
LVL 1

Author Comment

by:HenningF
ID: 10927416
Hmm, it has crossed my mind that it returns a datatype that simply isn't supported in vbscript but I thought since it actually is able to tell that it is a VarType 8200 it should also have some support for it. But luckily for me I managed to get a hold of the guy that made this web service and I'm talking to him on MSN right now actually! So hopefully he'll be able to find me a solution that will give me the right info...I'll let you know.
0
 
LVL 28

Assisted Solution

by:sybe
sybe earned 200 total points
ID: 10927444
BTW the Microsoft documentation on Vartypes is not complete. It lacks some datatypes that can not be created by VBScript, but in a certain way can be handled by VBScript. Examples:

Vartype = 14 - Decimal (sometimes returned from identity fields in a database)
Vartype = 8209 - Byte() (binary data, can be retrieved some several standard ActiveX components)

- - - -
There's only one more thing you could try:
Check what the IsArray() function is returns, and if it is True, hope that Join() will be able to handle the variable.


0
 
LVL 1

Author Comment

by:HenningF
ID: 10927457
IsArray() function ruturns true, but what is Join()? How do I use it? Never heared of it before...
0
 
LVL 15

Accepted Solution

by:
deighc earned 200 total points
ID: 10927468
> I thought since it actually is able to tell that it is a VarType 8200 it should also have some support for it

It doesn't really work like that. TypeName() for example will always be able to tell you the type name of an object variable (eg "IXMLDOM" for a XML DOM object) but that doesn't mean that VBScript has native functionality for working with the object.
0
 
LVL 28

Expert Comment

by:sybe
ID: 10927475
MyNewString = Join(MyArray, delimiter)

In your case for example:

<%
sTest = Join(appletInfo," ,")
Response.write sTest
%>
0
 
LVL 1

Author Comment

by:HenningF
ID: 10927495
Just looked up Join() in the documentation, tried it and it didn't work ->

Variable uses an Automation type not supported in VBScript
0
 
LVL 28

Expert Comment

by:sybe
ID: 10927497
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsfctJoin.asp

And while you are there: download the MS VBScript documentation (as help-file). Very nice to have it at hand

http://msdn.microsoft.com/library/default.asp?url=/downloads/list/webdev.asp
0
 
LVL 28

Expert Comment

by:sybe
ID: 10927526
Well, the best would be if the service would return a regular Array(), one that can be handled with VBScript.
It might work also to handle the variable as Byte().  But I have serious doubts about it.
To see if that works, try the MidB function on it:

<%
sTest = Byte2String(appletInfo)
Response.write sTest

Function Byte2String(ByVal s)
    Dim i
    For i = 1 to LenB(s)
        Byte2String = Byte2String & CHR(AscB(MidB(s,i,1)))
    Next
End Function
%>
0
 
LVL 1

Author Comment

by:HenningF
ID: 10927590
Damn...sorry for the foul language but the dll I'm using to communicate with the webservice had an undocumented class that returned the same array as an "|"-delimited string, arrrrrrgggggghhhhhhhhhhh! I spent sat up from midnight to about 5am last night to figure this out...

Now, hmm...how will I separate these point...
0
 
LVL 1

Author Comment

by:HenningF
ID: 10927658
Ok, sybe and deighc got 200 each and then I gave the last 100 to lpzCoville, I hope you find this to be fair. I really appreciate the help you have provided guys...and fyi I did download and install the documentation. Will probably be using it alot :)
0
 
LVL 28

Expert Comment

by:sybe
ID: 10927850
>> TypeName() for example will always be able to tell you the type name of an object variable (eg "IXMLDOM" for a XML DOM object) but that doesn't mean that VBScript has native functionality for working with the object.

One comment one this:

TypeName() will return the Class name if it is an object. In such cases VarType will return 13 ("object"), or in some cases, when the class has a default function some other known vartype. For example VarType(Request.Form) returns 8 (String), but TypeName(Request.Form) returns IRequestDictionary.
But in all those cases the IsObject() returns "True"

Now the datatypes I mentioned are different from IXMLDOM in 2 ways:
- they have a seperate value returned on VarType() - (not listed in the MS VBScript docs)
- they return False on IsObject()

Which means that they are completely different datatypes.


0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

820 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