I am trying, without success, to iterate through an array of varying varTypes in vbScript.
NOTE: I am talking about a SINGLE dimensioned array, not a vbScript multi-dimensional array.
I can successfully create a test array as follows:
Dim aArray : aArray = array("A", "B", array(1,2,3,4), "D", array("have", "a", "happy", "holiday", "!"), 1, "last item")
As you can see, the primary array has items of varying types, some strings, some integers, and some arrays. Then, when looping, all goes well until iterating to the array item which holds another array.
I need to know what to do when I come to this part:
If typeName(aArray(i)) = "Variant()" Then
Here is the complete function to iterate and print the array:
For i = 0 to uBound(aArray)
If typeName(aArray(i)) = "Variant()" Then
'array item is another array e.g. vbScript typeName variant()
response.write "<tr><td>aArray(" & i & ")</td><td><table class=""debugVarsTbl""><tr><th>Value</th><th>typeName()</th></tr><tr><td>[Array()]</td><td>" & typeName(aArray(i)) & "</td></tr></table></td></tr>"
Else
'item is a standard string, integer, boolean, date, etc.
response.write "<tr><td>aArray(" & i & ")</td><td>" & aArray(i) & " (" & typeName(aArray(i)) & ")</td></tr>"
End If
Next
I basically need to know how to access the main array item which is of vbScript typeName = Variant().
Thanks in advance and happy holidays, CBWDEV