Hello everybody. The question Im going to ask is not purely ASP, but the problem is on an ASP page. Let me resume the situation, I have an Excel spreadsheet. I need to display the values from the Excel document to an ASP page. This part is working. Now from these values, I need to make a line graph. I did the graph using Office Web Component. The graph is fine, but the problem is that the graph displays a limited number of records. I dont have the number in my head right now, since I'm at home. Well, lets say the graph displays a max of 10 records. 10 records are enough for me to do the graph. But, the 10 records start from the 1st record and end at the 10th record. The Excel document contains 883 (or 889) records.
When starting doing the page, Ive decided to display a record after each 30 records on the graph. Now to get these records out of 883 records, I've selected a record after each 30 records and put them in an array. In details, Ive selected record 30, 60, 90, 120... until end of recordset. But the method Ive used to get a record after each 30 records is very primitive.
The excel document has 3 columns.
Date|Col1|Col2
Here's the code:
I got the number of records and kept it in variable iCount, then Ive divided the number of records by 30, and kept the result in variable arrayMax. This means that I'll put a record in the array after each arrayMax'th record. In the loop, Ive started to populate the array after each arrayMax'th record.
1. Im not satisfied with this method. I dont know if it is the right method to do what I wanted.
2. Is there a way to select a record after each Nth record using SQL query?
3. If I do a loop in the recordset and response.write the 3 columns, all records in field Col1 and Col2 disply fine. But for the field date, only dates having the format dd.mm.yyyy got displayed. I cant the format of each date. From what Ive noticed, the date should have the dd.mm.yyyy in the cell, and also it should have the format dd.mm.yyyy in the formula bar, if not, the the value will be null in the recordset. And the Date field in a record is null, the graph wont take this record. On the graph, the date is on the X-axis.
Thanks for any input.
When starting doing the page, Ive decided to display a record after each 30 records on the graph. Now to get these records out of 883 records, I've selected a record after each 30 records and put them in an array. In details, Ive selected record 30, 60, 90, 120... until end of recordset. But the method Ive used to get a record after each 30 records is very primitive.
The excel document has 3 columns.
Date|Col1|Col2
Here's the code:
Code:
'**********************
'START COUNTING RECORDS
'**********************
Dim Count
If Not objRS.EOF Then
objRS.MoveFirst
Count = 1
Do While Not objRS.EOF
objRS.MoveNext
Count = Count + 1
Loop
objRS.MoveFirst
End If
'**********************
'END COUNTING RECORDS
'**********************
'**********************
'START POPULATING ARRAY
'**********************
Dim iCount
Dim arrayMax
Dim arrValues()
Dim limitCounter
Dim indexCounter
Dim strDate
Dim startDate
iCount = Int(Count)
arrayMax = int(iCount/30)
REDIM arrValues(2,int(arrayMax))
limitCounter = 1
indexCounter = 0
ObjRS.MoveFirst
Do While Not ObjRS.Eof
If limitCounter = arrayMax + 1 Then
' If objRS("Date") = "" Then
' arrValues(0,indexCounter) = " "
' Else
arrValues(0,indexCounter) = Cstr(objRS("Date"))
' End If
arrValues(1,indexCounter) = objRS("Col1")
arrValues(2,indexCounter) = objRS("Col2")
limitCounter = 1
indexCounter = indexCounter + 1
if indexCounter = arrayMax + 1 Then
exit Do
end If
End If
limitCounter = limitCounter + 1
ObjRS.MoveNext
Loop
'Putting last record in last item in array
objRS.MoveLast
arrValues(0,indexCounter-1) = objRS("Date")
arrValues(1,indexCounter-1) = objRS("Col1")
arrValues(2,indexCounter-1) = objRS("Col2")
endDate = objRS("Date")
'*********************
'END POPULATING ARRAY
'*********************
I got the number of records and kept it in variable iCount, then Ive divided the number of records by 30, and kept the result in variable arrayMax. This means that I'll put a record in the array after each arrayMax'th record. In the loop, Ive started to populate the array after each arrayMax'th record.
1. Im not satisfied with this method. I dont know if it is the right method to do what I wanted.
2. Is there a way to select a record after each Nth record using SQL query?
3. If I do a loop in the recordset and response.write the 3 columns, all records in field Col1 and Col2 disply fine. But for the field date, only dates having the format dd.mm.yyyy got displayed. I cant the format of each date. From what Ive noticed, the date should have the dd.mm.yyyy in the cell, and also it should have the format dd.mm.yyyy in the formula bar, if not, the the value will be null in the recordset. And the Date field in a record is null, the graph wont take this record. On the graph, the date is on the X-axis.
Thanks for any input.