Destiny Amana
asked on
ARRAY trouble shooting
I have a string that is passed through a web service.
paytxncode, I use the ASP Function split , to split it up with the & sign and we always get 8 values.
Problem is if an incorrect value is based in the web service, we get back a string with only 2 items.
How do I code to make sure the page does not fail on errors.
Here is what I have written already
ptbc=Split (paytxncode,"&") ' Once Split we get 8 values in the Array
if ISNULL(ptbc(2)) then
' Only 2 values in the array sent back
rspcode = ptbc(0)
rspdesc = ptbc(1)
rspcodetext = Split(rspcode,"=")
'Response.Write "<p> <b>RESPONSE CODE </b>: " & rspcodetext(1) & "<p>"
rspdesctext = Split(rspdesc,"=")
'Response.Write "<p> <b>RESPONSE DESCRIPTION </b>: " & rspdesctext(1) & "<p>"
else
'Normal 8 values
transtime = ptbc(0)
pan = ptbc(1)
froacc = ptbc(2)
toacc = ptbc(3)
paytxncode = ptbc(4)
appamt = ptbc(5)
rspcode = ptbc(6)
rspdesc = ptbc(7)
End if
paytxncode, I use the ASP Function split , to split it up with the & sign and we always get 8 values.
Problem is if an incorrect value is based in the web service, we get back a string with only 2 items.
How do I code to make sure the page does not fail on errors.
Here is what I have written already
ptbc=Split (paytxncode,"&") ' Once Split we get 8 values in the Array
if ISNULL(ptbc(2)) then
' Only 2 values in the array sent back
rspcode = ptbc(0)
rspdesc = ptbc(1)
rspcodetext = Split(rspcode,"=")
'Response.Write "<p> <b>RESPONSE CODE </b>: " & rspcodetext(1) & "<p>"
rspdesctext = Split(rspdesc,"=")
'Response.Write "<p> <b>RESPONSE DESCRIPTION </b>: " & rspdesctext(1) & "<p>"
else
'Normal 8 values
transtime = ptbc(0)
pan = ptbc(1)
froacc = ptbc(2)
toacc = ptbc(3)
paytxncode = ptbc(4)
appamt = ptbc(5)
rspcode = ptbc(6)
rspdesc = ptbc(7)
End if
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window