travisbrown
Technical User
- Dec 31, 2001
- 1,016
I am calling a recordset using getstring to create an array. I am doing this because some of the records ate single dates, multiple dates seperated by commas, and dates with text strings seperated by commas. I use a loop to weed out the non-dates using isDate. I then put all the results in a select box for a form.
Is there a way to only write distinct values? I'm not sure how to refer back into the collection. If I was doing it in the db I could use IN.
Here is a quick mockup
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/connABS_IT.asp" -->
<%
Dim rs
Dim rs_numRows
Set rs = Server.CreateObject("ADODB.Recordset"
rs.ActiveConnection = MM_connABS_IT_STRING
rs.Source = "SELECT i_raised_by FROM tblIssues"
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 1
rs.Open()
rs_numRows = 0
%>
<%
TM = rs.GetString(,,,","
%>
<%
rs.Close()
Set rs = Nothing
%>
<%
Dim TM
tmarray = split(TM,","
response.write "<select name='seminars'>"
for i = 0 to UBOUND(tmarray)
tmitem = cStr(tmarray(i))
IF isDate(tmitem) = true then
response.write "<option>" & tmitem & "</option>"
end if
next
response.write "</select>"
%>
Is there a way to only write distinct values? I'm not sure how to refer back into the collection. If I was doing it in the db I could use IN.
Here is a quick mockup
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/connABS_IT.asp" -->
<%
Dim rs
Dim rs_numRows
Set rs = Server.CreateObject("ADODB.Recordset"
rs.ActiveConnection = MM_connABS_IT_STRING
rs.Source = "SELECT i_raised_by FROM tblIssues"
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 1
rs.Open()
rs_numRows = 0
%>
<%
TM = rs.GetString(,,,","
%>
<%
rs.Close()
Set rs = Nothing
%>
<%
Dim TM
tmarray = split(TM,","
response.write "<select name='seminars'>"
for i = 0 to UBOUND(tmarray)
tmitem = cStr(tmarray(i))
IF isDate(tmitem) = true then
response.write "<option>" & tmitem & "</option>"
end if
next
response.write "</select>"
%>