Tornado Class Library

Special Topic - 2010 Special Features - Pdf Report and XML Tree

The 2010 upgrade has a lot of new features. Take a test run of the following test files to get a feel.
 

 

Example #1 Source Code
<script language='vb' runat='server'>
Sub Page_Load(Source as Object, E as EventArgs)
'... NWIND PDF report
'... Note that you must speecify the BaseURL of the application images and css.
   Dim x As New Tornado.z
   x.dbQP = "U=1| D=./EMPLOYEE-XML.MDB| Q=EMPLOYEES| Gdf=0,1,2,3,4,5| Iv=t"
   x.dbPdf = "Security=Edit=f|Info=Author=Frank Kwong!Subject=Nwind Report!Title=2009 Northwind Report|" & _
      "Cover=./MyCover.html|" & _
      "BaseURL=http://www.aspdb.com/Tornado/css/buttons/green|" & _
      "SetupHD=HtmlPath=./MyHeader.html!Height=100|" & _
      "TextHD=Text=Northwind Sales of 2009!Align=Center!y=60!size=14!color=Black; Text=Pdf Report!xy=350,5!size=14!color=Black|" & _
      "ImageHD=imagePath=./nwind.gif!xy=100,25!width=50|" & _
      "SetupFT=HtmlPath=./MyFooter.html!Height=55!AutoPage=t!YAutoPage=20|" & _
      "TextFT = Text=&dt(MMM-dd-yy HH:mm)!xy=45,25!size=8!color=Black|" & _
      "TextWM=Text=ASPDB!xy=0,0!size=50!color=RED!Transparency=25!Rectangle=280,300,300,100|" & _
      "ImageWM=Path=./logo.gif!Transparency=25
   x.ASPdbNET()
End Sub
</script>

 

Example #2 Source Code

2 modules in one application file via postback. Regular Tornado Display module and popup Pdf template report module.

<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
   Dim myself = Request.ServerVariables("SCRIPT_NAME")
   Dim id As String = ""
   Dim pop As String = "<A HREF='" & myself & "?Id=#FacilityID#' " & _
      "Target='PDFwin' onClick=""window.open('','PDFwin', " & _
      "'width=900, height=820, left=400, top=400, directories=no, menubar=no, toolbar=no, status=no, resizable=yes')"">" & _
      "#FacilityID#</A>"
   Dim x As New Tornado.z
   If Not IsNothing(Request.QueryString("Id")) And Request.QueryString("Id") <> "" Then '... postback popup Pdf report module
      id = Request.QueryString("Id") '... Report Module
      x.dbQP = "u=2| Ps=-1| D=./book1.xls|dt=excel|ni=none|di=CODE"
      x.dbSQL = "Select * from [FID] where FacilityID = '" & id & "'"
      x.dbGridDisplayFlds = "TankNo,TankSize,TankSubstatnce, TankInstalled,TankStatus,TankLastInspectionType,TankLastInspection"
      x.dbNameMap = "f=TankNo|al=No., f=TankSize|al=Size, f=TankSubstatnce| al=Substance,f=TankInstalled|al=Install Date, f=TankStatus| al=Status,f=TankLastInspectionType| al=Last Insp Type,fi=TankLastInspection| al=Last Insp Date"
      x.dbGridTemplate = "file=./Keystone_template.html"
      x.dbPdf="baseurl=http://www.aspdb.com/Tornado/testfiles"
      x.ASPdbNET()
   Else '... Query Module
      x.dbQP = "u=1|Ps=30| M=Ty=DH! sysind=t | D=./book1.xls|dt=excel"
      x.dbTextHolder = "tit=PA Tanks Inventory Query| sub=Click the Facility ID link to see report"
      x.dbGridDisplayFlds = "FacilityID,OwnerName"
      x.dbSQL = "Select * from [FID]"
      x.dbFormMagicCell = "(;![]#|~/+{})f=FacilityID| mac=" & pop
      x.dbOptions = "KeepUserQueryString=false" 
      x.ASPdbNET()
   End If
End Sub
</script> 

 

Example #3 Source Code

The xml=true options in the dbMemoflds informs Tornado that the text is in XML format. An date then will be displayed in a tree format. This is a DB within a DB.

<script language='vb' runat='server'>
Sub Page_Load(Source as Object, E as EventArgs)
Dim x As New Tornado.z()
'... set id file (idd) in curdir
   x.dbQP = "U=1| ps=-1| s=1| D=/tornado/db/EMPLOYEE-XML.MDB| Ni=none| gdf=1,2"
   x.dbSQL = "SELECT * FROM Employees"
   x.dbTextHolder = "Title=My XML Report| sub=Database (XML) within a database"
   x.dbMemoFlds = "f=XMLAddr| xml=true| Title=Employee XML Profile"
   x.dbMode = "type=Grid| Ind=1"
'... Make XML on the side instead of below.
   x.dbGridTemplate = "<center><table class='nb'><tr valign='top'><td>[[Grid]]<p>[[GridNav]]<p>[[GridStat]]</td><td>[[Memo]]</td></th></table></center>"
'... modify XML data content in runtime using magiccell!
'... data macro = id='' so no blowup even if magiccell fails. Replace with id=''+id='#2# #1#'
   x.dbMagicCell = "f=XMLAddr| mac={id=''+id='#2# #1#'}"
'...set tree icon file is in curdir (tid)
   x.dbTreeParams = "height=400 "
   x.ASPdbNET()
End Sub
</script>

 

Example #4 Source Code

The dbmode type=XMLTree option informs Tornado that the grid cell text is in XML format. An date then will be displayed in a tree format.

<script language='vb' runat='server'>
Sub Page_Load(Source as Object, E as EventArgs)
'...NWIND Employee table is modified with 2 XML fields - XMLProfile, XMLAddr
'...Assume you have the aspdbtree.class in the /tornado/jar dir. If not copy it there
   Dim x As New Tornado.z()
'... set id file (idd) in curdir
   x.dbQP = "U=1| ps=5| s=1| D=./EMPLOYEE-XML.MDB"
   x.dbSQL = "SELECT * FROM Employees"
   x.dbGridDisplayFlds = "XMLProfile, XMLAddr"
   x.dbTextHolder = "Title=My XML Report| sub=Database (XML) within a database"
   x.dbMode = "type=XmlTree"
'... modify XML data content in runtime using magiccell!
   x.dbMagicCell = "fi=XMLAddr| mac={id=''+id='#2# #1#'},fi=XMLProfile| mac={id=''+id='#0#'}"
'...set tree icon file is in curdir (tid)
   x.dbTreeParams = "height=400 "
   x.ASPdbNET()
End Sub
</script>

Send comments on this topic.
Copyright 1998-2010 ASP-db