Hi everybody.
I've been trying to find the best way of splitting data from a GetRows() function into a two column HTML table but haven't been able to come up with anything myself or fin d much of use online. Maybe one of you guys have tackled a similar issue.
First of all, here's my code:
What I want to do is print half of the returned records from the second GetRows() (the clinics) into the first column <td> and then print the rest into the second.
I can split them fine if the number of records returned is even, but if they are odd are want the larger number printed in the first column and the remainder in the second. For example, if nine records are returned I want 5 in the first and 4 and the second and so on.
I'm always looking for ways to make my code as efficient as possible so any suggestions/examples would be greatly appreciated.
Thanks.
I've been trying to find the best way of splitting data from a GetRows() function into a two column HTML table but haven't been able to come up with anything myself or fin d much of use online. Maybe one of you guys have tackled a similar issue.
First of all, here's my code:
Code:
<%
strSQL = "SELECT * FROM SHOW_COUNTIES WHERE REGION_ID = " & regionId & ";"
call getData(strSQL, rsTemp, "region")
arrCounties = rsTemp.GetRows()
for i = 0 to UBound(arrCounties,2)
%>
<table width="98%" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" class="countyHeader">CORA Clinics - <%= arrCounties(1,i) %> County<a name="<%= arrCounties(1,i) %>"></a></td>
</tr>
<tr>
<td height="6"></td>
</tr>
</table>
<table width="98%" style="margin: 0px 5px;">
<tr>
<td width="50%" valign="top" align="center">
<%
strSQL2 = "SELECT CLINIC_ID, CLINIC_NAME FROM CLINICS WHERE CLINIC_COUNTY_ID = " & arrCounties(0,i) & ";"
call getData(strSQL2, rsTemp2, "region")
arrClinics = rsTemp2.GetRows()
for c = 0 to UBound(arrClinics,2)
Response.Write("<table width='98%' cellpadding='0' cellspacing='0'>")
Response.Write(" <tr>")
Response.Write(" <td class='treemenu' width='9'><img src='../images/sm_arrow.gif' class='expand'></td>")
Response.Write(" <td class='treemenu'><a href='clinic_details.asp?clinicId="&arrClinics(0,c)&"'>"&arrClinics(1,c)&"</a></td>")
Response.Write(" </tr>")
Response.Write("</table>")
next
%>
</td>
<td width="50%" valign="top" align="center">
</td>
</tr>
</table>
<p id="small">
<%
next
%>
What I want to do is print half of the returned records from the second GetRows() (the clinics) into the first column <td> and then print the rest into the second.
I can split them fine if the number of records returned is even, but if they are odd are want the larger number printed in the first column and the remainder in the second. For example, if nine records are returned I want 5 in the first and 4 and the second and so on.
I'm always looking for ways to make my code as efficient as possible so any suggestions/examples would be greatly appreciated.
Thanks.