Tornado Class Library

Special Topics - Remote Data Integration

Remote Data is a powerful application of ASP-db. It's functions is to collect data from any URLs, process the data and then return results to the calling browser. This feature can be used by many advanced applications. The data can be encrypted at creation and decrypted in colletion using ASPdbConvert method.

 

ASPdbRemote Method

This method when executed will look for the ASPdbRemote variable in the querystring. This querystring is supposed to hold the URL of an ascii script file. After reading this file, the scripts within the <tags>..</tags> will be retrieved and the corresponding tasks will be performed. At this time, only the <ASPdbRemoteChart>..</ASPdbRemoteChart> is implemented. The script inside this block will be used to plot a chart. Format of the script is PARAM=Value.

 

dbbRemoteURL Property

Obj.dbRemoteURL = "URL1;EncryptKey1| URL2;EncryptKey2|...|ID=True "

Define URLs and ready for data collection.Example - Obj.dbRemoteURL = "http://url1/sales1.data| http://url2/sales2.data". These URL are Ascii data files that can be listed by the browser. That means, all the URLs must have an IP or domain name such that it can be "reached". Place anywhere ID=True then an ID column will be added to identify the source, you can then use a lookup to display the ID in your preferred format.

Example: .dbSQL = "Select * From [[RemoteTable]] where val(id) > 1"

Note:

 

.ASPdbRemoteDataCollection Method

Collect the same Data-Blocks from all the URLs and create a table. If Block does not exist then the entire file will be read. A data block is one tagged by <Data-Block-Name>...</Data-Block-Name>.

e.g. .ASPdbRemoteDataCollection("Sales") - This example indicates that the <Sales>...</sales> data block should be extracted from the remote URL file for consolidation. If block name is omitted then the entire file contains only one data set.

 

[[RemoteTable]] Macro

This csv file is created dynamically with a unique name for the session in the scratch directory. This Csv file consolidate the date from the data collected from the URLs. At this point, the Csv file can be queried and construct reports.
 

Remote Data Collection Example

Collect data from two different URLs

Dim Rm As New Tornado.Z()
Rm.dbRemoteURL = "http://www.aspdb.com/Tornado/DB/sales1.data | http://www.aspdb.com/Tornado//DB/sales2.data"
Rm.ASPdbRemoteDataCollection("Sales")

http://www.aspdb.com/Tornado/DB/sales1.data


<sales>
"DEPT","JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"
"US Shoe","1000","2000","3000","5000","2000","6000","9000","10000","6000","7500","8000","1000"
"US Music","1100","2200","3040","5100","2500","7000","8000","1100","6500","8500","9000","10000"
"US Sport","5100","2900","4040","5180","2500","7700","8050","7100","6200","8300","9990","15000"
</sales>

http://www.aspdb.com/Tornado/DB/sales2.data

<sales>
"DEPT","JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"
"Asia Shoe","1000","2400","5000","5000","2200","6100","9900","10500","6600","1500","8200","7000"
"Asia Music","1200","2300","7040","5100","2600","7800","1000","1200","2500","8000","9200","11000"
"Asia Sport","1500","9200","7040","1580","5200","7400","1050","1700","2600","3800","2990","5000"
</sales>

Consolidate two URLs into a single Csv table

<script language="vb" runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
  Dim Rm As New Tornado.Z()
  With Rm
    Rm.dbRemoteURL = "http://www.aspdb.com/Tornado/DB/sales1.data | http://www.aspdb.com/Tornado//DB/sales2.data"
    Rm.ASPdbRemoteDataCollection("Sales")
'------- Process Consolidated Data - Plot a Cluster Chart --------
    .dbUnit = "95
    .dbSkin=-1
    .dbMode = "Grid"
    .dbDSN = "Provider=Microsoft.Jet.OLEDB.4.0; Extended Properties=Text; Data Source=" & _
    Server.MapPath("/tornado/scratch")
    .dbPageSize = -1
    .dbSQL = "Select * From [[RemoteTable]]"
    .dbTextHolder = "Title=Tornado Demo - Remote Data Collection| sub=Consolidate the two URLs into a Csv table"
    .ASPdbNET()
  End with
End Sub
</script>

 

Data Secyrity - Encrypting the Data Files

First Encrypt the data files using -

Dim fin As String = "c:\inetpub\wwwroot\tornado\db\sales1.txt"
Dim fenc As String = "c:\inetpub\wwwroot\tornado\db\sales1e.txt"
Dim fin2 As String = "c:\inetpub\wwwroot\tornado\db\sales2.txt"
Dim fenc2 As String = "c:\inetpub\wwwroot\tornado\db\sales2e.txt"
Dim Mydb As New Tornado.z
If (Mydb.ASPdbConvert("en", fin, fenc, "Hello-My-Key")) Then Mydb.ASPdbDisplaySource(fenc)
If (Mydb.ASPdbConvert("en", fin2, fenc2, "Hello-My-Key")) Then Mydb.ASPdbDisplaySource(fenc2)

Then, add the encrypt key to the dbRemoteURL property -

Dim Ru as string = "http://" & MyServer & "/tornado/DB/sales1e.txt;Hello-My-Key |"
Ru &= "http://" & MyServer & "/tornado/DB/sales2.txt;Hello-My-Key"
.dbRemoteURL = Ru

Now, your Remote Data application is secured!

 

Remote Charting Example

This is just about the shortest program (actually a ONE line program - excluding custom title) you can write in ASPdb.Net and you will be surprised what it produces. The program RemoteChart.aspx is the program you'll write when using ASPdb.Net. The MyChart1.txt is a text macro file that your customer will write and place in their local URL. The URL location of this file will have to be reachable or the chart publisher and the chart viewing customers furnishing the data files have to be on the same side of the firewall. To experience a demo, cut and paste the MyChart1.txt file and place that in your URL reachable directory and then supply that URL as ->

http://www.aspdb.com/site/tor/manual04/code/eg_/RemoteChart.aspx?ASPdbRemote=http://YourURL/YourDirectory/Mychart.txt

and the charts will be plotted for you in your browser. If you got that running, then you can start to modify the plotting parameters. Multiple charts can be plotted via a pair of tags. Now, all the departments of your company can place their daily performance data on their server and you, the boss, can view these charts on your browser with data from different sources on a real time basis. The same goes for output of every production machine can be monitored on a real time basis. Oh, I forgot to mention that there is a built-in Chart refresh parameter for such an operation. Stay tune for more implementations of "ASPdbRemote". In this example, the Chart data file MyChart1.txt is placed in the http://www.aspdb.com/tornado/temp directory. So you can image that if you do not have a reachable URL, you can place the file to another workstation which has reachable URL and the chart will be delivered to your browser.

eg_RemoteChart.aspx

<script language="vb" runat="server"> 
Sub Page_Load(Source as Object, E as EventArgs) 
   Dim Rmc As New Tornado.Z() 
   Rmc.dbUnit = 111 
   Rmc.dbSkin = 14 
   Rmc.dbTextHolder = "Title=Tornado Demo - Remote Charting|subtitle=Read the Comments Section!" 
   Rmc.ASPdbRemote() 
End Sub 
</script>

MyChart.txt

ID=ASPdb.Net 
TitleString = My Remote Bubble Chart 
titleFont=TimesRoman,14,1 
Type = Bubble 
Width=400 
Height=400 
dataset0y2Values=100,200,300 
dataset0yValues=234,543,-523 
dataset0xValues=-1,0,1 
dataset1y2Values=100,200,300 
dataset1yValues=321,432,456 
dataset1xValues=-1.5,0.2,1.2 
dataset0Name=ASPDB.Net 
dataset1Name=ASPDB 
legendOn=true 
legendColor=transparent 
legendLabelColor=white 
legendLabelFont=Helvetica,10,0 
crossAxes=true 
dataset0Links=http://www.usintertech.com,http://www.usintertech.com,http://www.usintertech.com 
dataset0Labels=ASP+,ASP.Net,The most powerful Application Genreator 
dataset1Links=http://www.aspdb.com,http://www.aspdb.com,http://www.aspdb.com 
dataset1Labels=Classic ASP,COM+ Component,Original and the Best 
dwellUseLabelString=true 
dwellUseXValue=false 
dwellUseYValue=false 
xAxisColor=white 
yAxisColor=white 
xAxisOptions=minTickOn 
yAxisOptions=minTickOn 
backgroundColor=A7B5DF 
plotareaColor=A7C5DF 
titleFont=Helvetica,20,0 
xAxisLabelFont=Helvetica,10,0 
yAxisLabelFont=Helvetica,10,0 
plotareaRight=0.9 
plotareaLeft=0.1 
plotareaBottom=0.1 
outlineColor=black 
backgroundImage=/aspdbnet/background.jpg 
</ASPdbRemoteChart>

 


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