Combinging multiple arrays

Results 1 to 2 of 2

Thread: Combinging multiple arrays

  1. #1
    Phil Forbes Guest

    Default Combinging multiple arrays

    I&#039m having to resort a recordset in a specific order (1 2 3 4 1 2 3 4 etc.) so I&#039ve dumped all the information into several arrays and sorting through them. The problem I&#039m running into is that I keep ending up with an empty array element at the end where it should be placing the final entry, and I can&#039t seem to find the problem. Here&#039s the code that I&#039m using. If anyone has any ideas, I&#039d really appreciate it.<BR><BR>Thanks!If IsEmpty(Session("aResults")) Or request.querystring("first") Then<BR> Dim tmpSQL<BR> tmpSQL = SQL<BR> SQL = SQL & " ORDER BY mod_speed"<BR> set srs = SCONN.execute(SQL)<BR> <BR> If NOT srs.EOF And NOT srs.BOF Then<BR> aResults = srs.GetRows<BR> <BR> iRows = UBound(aResults, 2)<BR> iCols = UBound(aResults, 1)<BR> <BR> If allcomp Then<BR> reDim aResults(iCols, iRows)<BR> SQL2 = "SELECT companyid, comp_name FROM company WHERE companyid &#060;&#062; 0 ORDER BY comp_name"<BR> set comprs = SCONN.Execute(SQL2)<BR> compar = comprs.getrows<BR> set comprs = nothing<BR> compnum = ubound(compar,2)<BR> order = 0<BR> count = 0<BR> trows = 1<BR> for i = 0 to irows<BR> SQL2 = tmpSQL & " AND m.companyid = " & compar(0, order) & " ORDER BY mod_speed"<BR> set rs = SCONN.Execute(SQL2)<BR> If Not rs.EOF And Not rs.BOF Then <BR> subar = rs.getrows<BR> subsz = ubound(subar,2)<BR> Else<BR> subsz = -1<BR> End If<BR> set rs = nothing<BR> If count &#060;= subsz And subsz &#060;&#062; -1 then<BR> For i2 = 0 to icols<BR> aResults(i2, i) = subar(i2, count)<BR> Next<BR> trows = trows +1<BR> Elseif trows &#060; irows+1 then<BR> i = i - 1<BR> End If<BR> if order = compnum Then<BR> order = 0<BR> count = count + 1<BR> Else<BR> order = order +1<BR> End If<BR> Next<BR> End If<BR> Session("aResults") = aResults<BR> Else<BR> Nada = True<BR> End If<BR> Maketable<BR>Else<BR> Maketable<BR>End If<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Combinging multiple arrays

    Here&#039s the deal your recorset value is checked before the steps are run so if it hits EOF the last record is actually unread. I had a simular problem. so after the loop expires get the records one more time which is your last row.<BR><BR>For i=to rs.recordCount-1<BR> get records<BR> rs.movenext<BR>next<BR> get Record<BR><BR>whatever else

Posting Permissions

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