Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2617
  • Last Modified:

How to display VarType 8200 in my ASP classic

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
HenningF
Asked:
HenningF
  • 7
  • 6
  • 3
  • +1
4 Solutions
 
lpzCovilleCommented:
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
 
deighcCommented:
What does the TypeName function return variable??

Response.Write TypeName(myMagicVar)

Just curious..
0
 
HenningFAuthor Commented:
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
HenningFAuthor Commented:
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
 
deighcCommented:
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
 
sybeCommented:
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
 
HenningFAuthor Commented:
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
 
sybeCommented:
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
 
HenningFAuthor Commented:
IsArray() function ruturns true, but what is Join()? How do I use it? Never heared of it before...
0
 
deighcCommented:
> 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
 
sybeCommented:
MyNewString = Join(MyArray, delimiter)

In your case for example:

<%
sTest = Join(appletInfo," ,")
Response.write sTest
%>
0
 
HenningFAuthor Commented:
Just looked up Join() in the documentation, tried it and it didn't work ->

Variable uses an Automation type not supported in VBScript
0
 
sybeCommented:
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
 
sybeCommented:
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
 
HenningFAuthor Commented:
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
 
HenningFAuthor Commented:
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
 
sybeCommented:
>> 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 6
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now