Passing, Receiving, Verifying a Nested Array as a

Results 1 to 2 of 2

Thread: Passing, Receiving, Verifying a Nested Array as a

  1. #1
    Join Date
    Dec 1969

    Default Passing, Receiving, Verifying a Nested Array as a

    I have looked at the FAQ and picked up a few things, but I still can&#039;t figure this one out.<BR><BR>Ok, this is what I have:<BR>x = array(1, 2, 3)<BR>y = array(4, 5, 6)<BR>z = array(7, 8, 9)<BR>Cart_array = array(x, y, z)<BR>Session("Cart") = Cart_array<BR>&#039;this is my session that is also my cart.<BR><BR>SO, I can pass and read it once it already exist, no problem!<BR><BR>HOWEVER, creating it and verifing it exsist is a whole nother matter...I have tried:<BR>&#039;ready session back into page<BR><BR>Cart_Array = Session("Cart")<BR>If IsArray(Cart_Array) then <BR>&#039;do whatever, but it never hits this?<BR><BR>If Cart_Array = "" then<BR>&#039;seeing if cart exists, but because it is a nested array, no go!<BR><BR>SO, Any help would be appreciated...I would like to know how to verify if this is session and read to see how many items (x, y, z) are in it, then be able to add ot subtract from it. What if there is only one item? It goes from a String to an integer? is it still a nested array if it looks like this?<BR><BR>x = array(1, 2, 3)<BR>Cart_Array = array(x)<BR><BR>Thanks, for all your help in advance as this is something that has been a week in the process.<BR>Doug<BR>

  2. #2
    Join Date
    Dec 1969

    Default Dunno what you're doing wrong...

    ...but it worked 100% as expected for me.<BR><BR>Here&#039;s my test page, which I simply hit once (and got the "created" message) and then hit refresh (and got the "already" message).<BR><BR>******* ca.asp ********<BR>&#060;HTML&#062;&#060;BODY&#062;<BR>&# 060;%<BR>Cart_Array = Session("Cart") <BR>Response.Write "TypeName(Cart_Array) is " & TypeName(Cart_Array) & "&#060;br/&#062;"<BR>Response.Write "VarType(Cart_Array) is " & VarType(Cart_Array) & "&#060;HR&#062;"<BR><BR>If IsArray(Cart_Array) then <BR> Response.Write "Already have array in cart.&#060;br/&#062;"<BR> Response.Write "Example: Cart_Array(1)(2) is " & Cart_Array(1)(2) & "&#060;P&#062;"<BR>Else<BR> x = array(1, 2, 3) <BR> y = array(4, 5, 6) <BR> z = array(7, 8, 9) <BR> Cart_array = array(x, y, z) <BR> Session("Cart") = Cart_array <BR> Response.Write "Created Cart_array&#060;P&#062;"<BR>End If<BR>%&#062;<BR>&#060;/BODY&#062;&#060;/HTML&#062;<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts