
array problem
hi,<BR><BR>i am in a big problem.<BR>the results of previous form gave me this result,<BR><BR>46520400, 46120400, 4612040005, 4612040006, 46220400, 4622040005, 4622040006 <BR>so the string which contains the above is called mstrProdList<BR><BR>now i need to put these in an array and should be able to access each number as arraypr(0). arraypr(1) etc<BR>how do i do this??please help me.<BR><BR>

RE: array problem
Use the split function with ,(comma) as delimiter and retrive the values.

RE: array problem
hi,<BR>i used the following code,<BR> ProdArray=split(mstrProdList,",") <BR>but i get the error as,<BR><BR>Response object error 'ASP 0106 : 80020005' <BR>Type Mismatch <BR><BR>? <BR><BR>An unhandled data type was encountered<BR><BR>also, i tried,<BR>ProdArray = Split(mstrProdList, ", ", 1, 1)<BR>but i get the same error.<BR><BR>please help<BR>Thanks<BR><BR>

RE: array problem
try this:<BR><BR>dim aryProdLst()<BR><BR>mstProdList="46520400, 46120400, 4612040005, 4612040006, 46220400, 4622040005, 4622040006"<BR><BR>i=1<BR>redim aryProdLst(i)<BR>do while mstProdList<>""<BR> if instr(mstprodlist,",") then<BR> tmp=mid(mstProdList,1,instr(mstprodlist,",")1)<BR> mstProdList=mid(mstProdList,len(tmp)+2)<BR> else<BR> tmp=mstProdList<BR> mstProdList=""<BR> end if<BR><BR> aryProdLst(i1)=tmp<BR> redim preserve aryProdLst(i+1)<BR> i=i+1<BR>loop <BR>

RE: array problem
<BR> Dim ArrayProdList<BR> ArrayProdList = split(mstrProdList, ",")<BR> For iLoop = LBound(ArrayProdList) to Ubound(ArrayProdList)<BR> ArrayProdList(iLoop) = Trim(ArrayProdList(iLoop))<BR> Next

RE: array problem
if (Len(Trim(rs1("fieldname"))) <> 0) Then<BR>arrlist = Split(rs1.Fields("fieldname")), ",")<BR>Response.Write arrList(0) & ":" & arrList(1) & " " & arrList(2).<BR><BR>Yhis is for if you are retriving first the data in the recordset .then you can pass all the values of that recordset field into an array with , as delimiter.<BR><BR>You are getting typemismatch.<BR>try to debug your code at each and everystage as the logicis correct.Only some syntax error in datatype.<BR>check with response.write and end at each aand everystage.

RE: array problem
hi,<BR>i did what you suggested, but in my case i have 2 arrays one for id ProdArray and one for quantity ProdQty.<BR>now i need to add these to the shopping cart.<BR>in this case, count of id array is same as count of quantity array, so is it sufficient for me to do,<BR><BR>if Ubound(ProdArray)>1 Then<BR><BR> For i = LBound(ProdArray) to Ubound(ProdArray)<BR> ProdArray(i) = Trim(ProdArray(i))<BR> qtyArray(i) = Trim(qtyArray(i))<BR><BR><BR>and somewhere in my code, i call qtyArray(i).<BR>but it does not recognize qtyArray.<BR>this is the error i get,<BR><BR>Microsoft VBScript runtime error ' 800a000d' <BR>Type mismatch: 'qtyArray(...)' <BR><BR><BR>also, even though the array has 2 elements, the shopping cart displays just 1 element.<BR><BR><BR><BR>

RE: array problem
If both arrays have the same number of elements that should work fine.<BR><BR>Also, did you DIM the qtyArray?

RE: array problem
Hi,<BR><BR> I missed this earlier. The statement: if Ubound(ProdArray)>1 should be: if Ubound(ProdArray)>0, since the first element of the array is ProdArray(0).

RE: array problem
scot,<BR>i dimed the qtyarray.<BR>but now if the array has 3 elements, the shopping cart displays only the first and last. it omits the middle one. why is this.<BR>also, can you give me code example as to how to break string of ids into array and add the array into a shopping cart.<BR>your help will be really appreciated.<BR>Thanks,
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

