<% Option Explicit response.buffer = true %> Acronyms
CISR > Resource Library > Acronyms >
Acronyms

Search | Browse
<% if Session("LOGGEDIN") then %> <% end if %> <% dim sql sql = "Select * from Master ORDER BY Acronym" %> <% 'If the database is empty, tell the user so and quit. Else, create the display by first looping through 'the database and creating a quick index and then looping through again a second time to actually write 'out all the data. if rs.BOF And rs.EOF Then response.write "No Items Found" else '-------------------------------Start of Bookmarks---------------------------------------- dim intCol, intRow, Array, length, switch dim x, y, temp, temp2, z 'These variables are used only to create the bookmark links at the top of the list. There is 'another set after this section to create the actual list of items. dim b, c, bookmark, bookmark2 switch = false Array = rs.GetRows intCol = 2 intRow = rs.RecordCount intRow = intRow-1 %>
Index: <% for b=0 to intRow 'This IF section is testing the first letter of the acronym in the current and next record 'to determine if the length changes so it can indicate to write the bookmark bookmark (as in 'not bookmark2). if NOT b = intRow then length = len(Array(1,b)) - (len(Array(1,b))-1) bookmark = left(Array(1,b),length) c=b+1 length = len(Array(1,c)) - (len(Array(1,c))-1) bookmark2 = left(Array(1,c),length) 'Actually comparing the records and the setting the switch variable. If it is true then 'the last if/then in this section writes out the bookmark. if bookmark < bookmark2 then switch = true end if else temp = "" end if 'Writes out the header for the first level break for the beginning of the table if switch then response.write " " & bookmark2 & " " switch = false end if next response.write "
" '-------------------------------End of Bookmarks---------------------------------------- '-------------------------------Start Writing List---------------------------------------- %>
Total Records: <%=rs.recordcount%>

Acronym
Definition
<% rs.movefirst if rs.BOF And rs.EOF Then response.write "No Items Found" else Array = rs.GetRows intCol = 2 intRow = rs.RecordCount intRow = intRow-1 for y=0 to intRow 'This IF section is testing the first letter of the acronym in the current and next record 'to determine if the letter changes so it can create breaks in the table denoting such changes 'therefore creating a table that is easier to scan and search. if NOT y = intRow then length = len(Array(1,y)) length = length - (len(Array(1,y))-1) temp = Array(1,y) temp = left(temp,length) z = y+1 length = 0 length = len(Array(1,z)) length = length - (len(Array(1,z))-1) temp2 = Array(1,z) temp2 = left(temp2,length) elseif y-intRow = 0 then 'If there is only one record returned we want to print the heading row that includes the letter 'of the alphabet this record begins with. This will also prevent the application from thinking that 'we are at the end of the record set and therefore not print out the special character , which 'is used in the else statement below. length = len(Array(1,y)) length = length - (len(Array(1,y))-1) temp = Array(1,y) temp = left(temp,length) else 'If the end of the database is reached, we need to stop the application from creating a final 'break in the table, using "" as the highest value character in ASCII. I don't how to create this 'character, I don't even know what it is, so I just copied it from another website. :) temp = "" end if 'Writes out every record in the table one record at a time. %>
<%=array(1,y)%>
<%=array(2,y)%>
<% 'If the IF statement above finds a change in the first letter of the acronym, we create 'a new alphabetic section with a corrosponding bookmark. if temp < temp2 then response.Write("") %><%=temp2 %> - Top <% switch = false end if response.write "" next end if rs.Close rs = null conn.Close conn = null End if %>