
Splitting Session Variable into several variables (array?)
After the Split, check UBound(MyArray). If it isn't 7 then one or more of the 8 parts are missing.
If the missing parts are predictable based solely on the value returned by UBound(), then assign
session variables accordingly and use appropriate default values for those that are missing. If
there is no predictability, then buy a crystal ball ;-)...
--
Michael Harris
Microsoft.MVP.Scripting
--
Please do not email questions - post them to the newsgroup instead.
--
Hi Everyone,
We are trying to split up a session variable (result returned by our credit card
processor) containing multiple elements into seperate variables.
I have got this to work fine when all 8 elements are present, but not all of the
elements to the string are always present. Sometimes only one or two of the items
in the sample string below are present, so when not all 8 are present, I get
a 'out of range error' because i have hardcoded the results from the entire
array.
Does anyone know how I can split this into session variables so that it will work
regardless of how many elements their are in the string and array?
==== Begin Code ====
<% Session("SampleString") = "ZipCode, AddressCode, AuthCode, Auth2Code, TFICode,
Amount, Approved, Result" %>
<%
MyArray = Split(Session("SampleString"),", ")
Session("8") = MyArray(7)
Session("7") = MyArray(6)
Session("6") = MyArray(5)
Session("5") = MyArray(4)
Session("4") = MyArray(3)
Session("3") = MyArray(2)
Session("2") = MyArray(1)
Session("1") = MyArray(0)
%>
==== End Code ====
Thanks,
Andy Wolkin