Solved

How to display VarType 8200 in my ASP classic

Posted on 2004-04-26
17
2,471 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
Comment Utility
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
Comment Utility
What does the TypeName function return variable??

Response.Write TypeName(myMagicVar)

Just curious..
0
 
LVL 1

Author Comment

by:HenningF
Comment Utility
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
 
LVL 1

Author Comment

by:HenningF
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Author Comment

by:HenningF
Comment Utility
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
Comment Utility
> 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
Comment Utility
MyNewString = Join(MyArray, delimiter)

In your case for example:

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

Author Comment

by:HenningF
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
>> 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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/…
This video discusses moving either the default database or any database to a new volume.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now