All pastes #2988 Raw Edit

Anonymous

public text v1 · immutable
#2988 ·published 2004-12-15 03:31 UTC
rendered paste body
  Counter = 0
    lastDay = ""
    lastAdvertDay = ""
    Do While Not callRS.EOF
        ReDim Preserve callArray(2000, Counter + 1)
        If callRS.Fields.Count > 2 And GROUPBYcount > 1 Then
            If callRS(SELECTcount - 1) <> lastDay Then Counter = Counter + 1
            lastDay = callRS(SELECTcount - 1)
            If Not IsNull(callRS(SELECTcount - 2)) Then
                If Not dayhash.Exists(Trim(CStr(callRS(SELECTcount - 1)))) Then dayhash.Add Key:=Trim(CStr(callRS(SELECTcount - 1))), item:=(dayhash.Count + 1)
                If hash.Exists(Trim(CStr(callRS(SELECTcount - 2)))) Then
                    For i = 0 To SELECTcount - 3
                        callArray(hash.item(Trim(CStr(callRS(SELECTcount - 2)))) - 1, Counter - 1) = callRS(i)
                    Next i
                Else
                    hash.Add Key:=Trim(CStr(callRS(SELECTcount - 2))), item:=(hash.Count + 1)
                    For i = 0 To SELECTcount - 3
                        callArray(hash.item(Trim(CStr(callRS(SELECTcount - 2)))) - 1, Counter - 1) = callRS(i)
                    Next i
                End If
            End If
        ElseIf callRS.Fields.Count > 2 And GROUPBYcount = 1 Then
            If callRS(SELECTcount - 1) <> lastDay Then Counter = Counter + 1
            lastDay = callRS(SELECTcount - 1)
            For i = 0 To SELECTcount - 2
                    If Not hash.Exists(Trim(CStr(callRS.Fields(i).Name))) Then hash.Add Key:=CStr(callRS.Fields(i).Name), item:=(hash.Count + 1)
                    If Not dayhash.Exists(Trim(CStr(callRS(SELECTcount - 1)))) Then dayhash.Add Key:=Trim(CStr(callRS(SELECTcount - 1))), item:=(dayhash.Count + 1)
                    callArray(hash.item(Trim(CStr(callRS.Fields(i).Name))) - 1, Counter - 1) = callRS(i)
            Next i
        Else
            If callRS(SELECTcount - 1) <> lastDay Then Counter = Counter + 1
            lastDay = callRS(SELECTcount - 1)
            If Not hash.Exists(listType.Text) Then hash.Add Key:=Trim(listType.Text), item:=(hash.Count + 1)
            If Not dayhash.Exists(Trim(CStr(callRS(SELECTcount - 1)))) Then dayhash.Add Key:=Trim(CStr(callRS(SELECTcount - 1))), item:=(dayhash.Count + 1)
            callArray(hash.item(Trim(listType.Text)) - 1, Counter - 1) = callRS(0)
        End If
        If includeAdvertCost And lastDay <> lastAdvertDay Then
            Set advertRS = GetRS(obj4DBSConn, advertSQL & " AND start_date <= " & lastDay & " AND end_date >= " & lastDay)
            If Not dayhash.Exists(Trim(CStr(callRS(SELECTcount - 1)))) Then dayhash.Add Key:=Trim(CStr(callRS(SELECTcount - 1))), item:=(dayhash.Count + 1)
            callArray(hash.item("Advert Cost") - 1, Counter - 1) = advertRS(0)
            lastAdvertDay = lastDay
            advertRS.Close
        End If
        callRS.MoveNext
    Loop
    callRS.Close