Dynamic List

Dynamic list is a special drill down format. This format is widely used  to narrow the search via pre-programmed criteria. Dynalist feature is implemented in classic ASP-db using the Remote Scripting feature. Remote Scripting has since been removed from DotNet and many products based on this wonderful feature have gone out of business. Tornado reproduces this using standard DotNet libraries. On top of that more options are added.

Dynalist

<!--T_Dynalist.aspx-->

<script language="vb" runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
   Dim GD As New Tornado.Getdata()
  
Dim Trigger As Boolean = LCase(Request.QueryString("ASPdbDList_Trigger")) = "true"
   Dim i As Integer
   Dim spic As String = "<td valign=middle align=center><IMG SRC='/tornado/angel.jpg'></td>"
   Dim dy6 As New Tornado.Z()
   With dy6
      .dbQP="U=5| S=darkmoon| D=KJV2000.mdb|Th=tit=Dynamic Lists"
      Dim InTemplate As String = "<center><table><tr><td><span class=Ch>Book</span>[[Level0]]<span class=Ch>Chapter</span>[[Level1]]<span class=Ch>Verse(s)</span>[[Level2]]</td></center>"
If Not Trigger Then InTemplate &= spic
      .dbDynalist = "InputHtml=" & InTemplate & ";Level=0|Label=[Select a Book]|SQL=SELECT DISTINCT BookTitle FROM BibleTable;Level=1|Label=[Select a Chapter]|SQL=SELECT DISTINCT Chapter FROM BibleTable WHERE BookTitle = '{{0}}';Level=2|Tag=Multiple Size=Max|Label=[Select Verse(s)]|SQL=SELECT Verse FROM BibleTable WHERE BookTitle = '{{0}}' and Chapter = '{{1}}'"
      .ASPdbDynaList()
   End With

'------------- Trigger Display Code ---------------------

   If Trigger Then
      Dim Verses() As String = Split(Request.Form("ASPdbDlistSubmit"), ",")
      Dim Sel() As String = GD.Get_DListLevelSelectedItem
      Dim sql As String = "SELECT TextData FROM BibleTable WHERE BookTitle = '" & Sel(0) & "' and Chapter = '" & Sel(1) & "'"
      For i = 0 To UBound(Verses)
         sql &= IIf(i = 0, " AND (", " OR ") & "Verse = '" & Verses(i) & "'"  
      Next i
      sql &= ")"
      Dim D6 As New Tornado.Z()
      With D6
         .dbQP="U=55|D=KJV2000.mdb|S=darkMoon|PS=-1|Iv=t|xc=0|mts=-1"
         .dbSQL = sql
         .ASPdbNET()
      End With
      Dim Cexp(,) As String = GD.Get_Cexport
      Dim s2 As String
      For i = 0 To UBound(Sel)
         s2 &= "Selection Level #" & i & " is = " & Sel(i) & "<br>"
      Next
      s2 &= " ---------------------<br>"
      For i = 0 To UBound(Cexp, 2)
         s2 &= "[" & CInt(Verses(i)) & "] " & Cexp(0, i) & " "
      Next i
      Response.Write("<td valign=top class=R2>" & s2 & "</td></tr></table></Center>")
   Else
      Response.Write("<td>&nbsp;</td></tr></table></Center>")
   End If
End sub
</script>

This example is pretty much self contained with a cover picture, drilldown select boxes and a display screen. Note that all the levels selection are available for extraction and their values are displayed at the beginning. Unlike other dynamic lists which usually triggers at the final level, Tornado's dynamic list trigger can be at any level. That means you can redirect at any selection level based on the selected values. As you see that both input and output are included in the same file and this implementation is a clean as it can be!